Michael, I really appreciate your help. but I got the following error message when I wan trying to run the function written by you:
Error in out[i, ] <- apply(help[, c(grp1 + 1, grp2 + 5)], 2, sample, 1) : number of items to replace is not a multiple of replacement length I am not quite sure why would this happen. As a novice of R, these functions are kinda complex for me. I am wondering if it is doable without using loops like that. Again, thank you so much!!! -- View this message in context: http://r.789695.n4.nabble.com/Sampling-problem-tp3043804p3044249.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.