[R] random samples

nicolas.deig@epfl.ch nicolas.deig at epfl.ch
Thu Jan 13 13:50:38 CET 2005


hi,
I am encoutering a very little problem that seemed to be so easy to solve....
I need to divide the array

> A<-c(1:200)

 into two subsets at random. Therefore I use the function "sample" in R:

> S<-sample(A,100)

 for a random sample of size 100. Then I need the values in A that are not
selected in S to be put in another array, there is my problem!
Is there anyway to do this with a function of R or should I do one by myself?

Thanks in advance
Nicolas




More information about the R-help mailing list