[R] Using sample() twice (bootstrapping from > 1 vector)

Mark Myatt mark at myatt.demon.co.uk
Thu Dec 20 15:05:17 CET 2001


All,

I am using sample() to take bootstrap replicates and want to be able to
take replicates from multiple columns in a data.frame. I have done this
by using set.seed() to set the seed to the replicate number:

        for(i in i:10) {
          set.seed(i)
          x <- sample(...
          set.seed(i)
          y <- sample(...
          }                       
 
prior to the call to sample(). Is there a better way of doing this? Any
way of getting rid of the for() loop?

Mark

--
Mark Myatt


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list