Hello, The best way seems to be ?replicate.
set.seed(3997) # make it reproducible x <- rnorm(1002) # make up some data sim <- replicate(1000, sample(x, 20)) colSds <- function(x, na.rm = FALSE) apply(x, 2, sd, na.rm = na.rm) mu <- colMeans(sim) sigma <- colSds(sim) Hope this helps, Rui Barradas Em 31-07-2013 12:23, Rita Gamito escreveu:
Could anyone tell me how,from a pool of 1002 observations (one variable), can I resample 1000 samples of 20 observations? And then calculate the mean and standard deviation between 2, 3, 4, ..., 1000 samples and plot them? Thank you! _____________________________________ Rita Gamito Centro de Oceanografia Faculdade de Ciências, Universidade de Lisboa Campo Grande, 1749-016 Lisboa, Portugal e-mail: [email protected] Tel: + 351 21 750 00 00 - ext. 22575 Fax: + 351 21 750 02 07 www.co.fc.ul.pt ______________________________________________ [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 and provide commented, minimal, self-contained, reproducible code.
______________________________________________ [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 and provide commented, minimal, self-contained, reproducible code.

