new to R, trying to create a comparison group - so far this group contains 45 data points and I need to populate the remaining 55 (for a total of 100 data points). These remaining 55 need to be a randomized selection supplied from a larger data set. Any recommendations for R code that would create a randomization loop? thanks!
R Code randomizing selection
r;data
This will give you a sample with 55 record from the larger data-set that you have. sample <- df[sample(1:nrow(df), 55, replace=FALSE),]If you want to make a reproducible example of the sample, you need to set seed like this: set.seed(57) sample <- df[sample(1:nrow(df), 55, replace=FALSE),]So later you can use the same seed for getting the same result.p.s. replace=FALSE means that each record after that has been picked from the df to be included in the sample, will be excluded from the df and it will not be chosen multiple times.