Hi all, I have a data frame with tow variables group and its size. mydat<- read.table( text='group count G1 25 G2 15 G3 12 G4 31 G5 10' , header = TRUE, as.is = TRUE )
I want to select group ID randomly (without replacement) until the sum of count reaches 40. So, in the first case, the data frame could be G4 31 65 10 In other case, it could be G5 10 G2 15 G3 12 How do I put sum of count variable is a minimum of 40 restriction? Than k you in advance I want to select group ids randomly until I reach the ______________________________________________ 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.