Hi R user, I have samples with covariates for different classes, I wanted to choose the samples of different groups with different probabilities. For example, I have a 22 samples size with 3 classes, groupA has 8 samples groupB has 8 samples groupC has 6 samples
I want to select a total 14 samples from 22 samples, in which 40% of the 14 samples should be in groups A and B, 60% of the 14 samples should be in the group C. Would you mind to help me on how I can select the samples with that conditions? I have attached a sample data dat<-structure(list(sampleID = c(17L, 21L, 36L, 45L, 67L, 82L, 90L, 31L, 70L, 45L, 24L, 80L, 82L, 45L, 85L, 14L, 81L, 96L, 61L, 12L, 65L, 88L), group = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L), .Label = c("A", "B", "C"), class = "factor")), .Names = c("sampleID", "group" ), class = "data.frame", row.names = c(NA, -22L)) thanks, MW [[alternative HTML version deleted]] ______________________________________________ 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.