On Thu, Jan 13, 2005 at 01:50:38PM +0100, [EMAIL PROTECTED] wrote:

> I need to divide the array
> 
> > A<-c(1:200)
> 
>  into two subsets at random. Therefore I use the function "sample" in R:

I suggest a slightly different approach which is probably faster than
using setdif() or %in% and friends:

a <- 1:200
i <- sample(1:200, 100)
s1 <- a[i]
s2 <- a[-i]

cu
        Philipp
        
-- 
Dr. Philipp Pagel                            Tel.  +49-89-3187-3675
Institute for Bioinformatics / MIPS          Fax.  +49-89-3187-3585
GSF - National Research Center for Environment and Health
Ingolstaedter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/staff/pagel

______________________________________________
R-help@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

Reply via email to