Dear R-users Im working with a dataset that contains information for 8 groups of data and I need to select a sample of certain size (100 cubic feet by group) from this database for each of these 8 groups. To clarify, here is the starting code Im working with:
k<-nrow(dataset) ix<-sort(runif(k),index.return=TRUE)$ix M<-max(which(cumsum(dataset$volume[ix])<100))+1 test<-dataset[ix[1:M],] However, I don't know how to specify in this code the instruction: "by groups" Does anyone have an idea how to do this? Thanks in advance RW ______________________________________________ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
