[R] Array Manipulation

Douglas Bates bates at stat.wisc.edu
Thu Jan 27 21:18:15 CET 2005


Liaw, Andy wrote:
> Something like:
> 
> dat[dat$ID %in% sample(unique(dat$ID), 3), ]
> 

or

subset(dat, ID %in% sample(unique(ID), 3))

which I find to be more readable.




More information about the R-help mailing list