[R] subsampling

james.holtman@convergys.com james.holtman at convergys.com
Fri Jan 14 18:06:17 CET 2005





Consider using a list.  This will create a list with 10 entries of your 20
samples:

x <- 1:200
myList <- split(x, cut(sample(x,200),breaks=10))

__________________________________________________________
James Holtman        "What is the problem you are trying to solve?"
Executive Technical Consultant  --  Office of Technology, Convergys
james.holtman at convergys.com
+1 (513) 723-2929


                                                                                                                                           
                      nicolas.deig at epfl.ch                                                                                                 
                      Sent by:                     To:       r-help at stat.math.ethz.ch                                                      
                      r-help-bounces at stat.m        cc:                                                                                     
                      ath.ethz.ch                  Subject:  [R] subsampling                                                               
                                                                                                                                           
                                                                                                                                           
                      01/14/2005 11:23                                                                                                     
                                                                                                                                           
                                                                                                                                           




hi,

I would like to subsample the array c(1:200) at random into ten subsamples
v1,v2,...,v10.

I tried with to go progressively like this:


> x<-c(1:200)
> v1<-sample(x,20)
> y<-x[-v1]
> v2<-sample(y,20)

and then I want to do:

>x<-y[-v2]
Error: subscript out of bounds.

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list