Hi, thank you but it does work for vectors and matrix but not dataframes, it gives me this message error:
MeanA <- read.csv("MeanAmf.csv",header=T) mysample <- MeanA[sample(1:nrow(MeanA), 20, replace=FALSE),] remainder<-MeanA[-mysample] Error in `[.default`(MeanA, -mysample) : invalid subscript type 'list' In Ops.factor(left) : - not meaningful for factors Any other way? -- View this message in context: http://r.789695.n4.nabble.com/Sampling-problems-tp4453752p4455912.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list 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.