I was wondering if this is a good alternative method to split a data column into distinct groups. Let's say I want my first group to have 4 elements selected randomly
mydata <- LETTERS[1:11] random_grp <- sample(mydata,4,replace=FALSE) Now random_grp is: > random_grp [1] "H" "E" "A" "D" # How's that for a random selection! Now my choices for another group of random data now becomes: data_wo_random <- setdiff(mydata,random_grp) > data_wo_random [1] "B" "C" "F" "G" "I" "J" "K" Now from this reduced dataset, I can generate another random selection with any size I choose. One problem with this is that this is cumbersome when ones original dataset is large or when one wants to subgroup the original dataset into many different subgroup sizes. Nevertheless, it's an intuitive method which is relatively easy to understand Hope this helps! Thomas Subia Statistician ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.