Laura Quinn <laura <at> env.leeds.ac.uk> writes: > I was wondering whether there is a way to select random samples from a > data matrix, retaining the indexing for the rows and columns?
Is this you are looking for? Dieter # create data n = 10 world = array(rnorm(n*n*n),c(n,n,n)) nsamples=12 # create indices isample = matrix(sample(n,3*nsamples, replace=T),nrow=nsamples) # use indexes to pick world samples world[rbind(isample)] ______________________________________________ [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
