RE: [R] Array Manipulation

2005-01-27 Thread Liaw, Andy
Something like: dat[dat$ID %in% sample(unique(dat$ID), 3), ] Andy > From: [EMAIL PROTECTED] > > I have a data set that looks like the following: > ID Responce > 1 57 > 1 63 > 1 49 > 2 31 > 2 45 > 2 67 > 2 91 > 3 56 > 3 43 > 4 23 > 4 51 > 4 61 > 4 76 > 4 68 > 5 34

Re: [R] Array Manipulation

2005-01-27 Thread Douglas Bates
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. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Array Manipulation

2005-01-27 Thread Eric Rodriguez
and something like that: dat[dat$ID == sample(unique(dat$ID), 3), 2] ? I'm not sure about the ",2" maybe you need the full matrix ? ps: first time, i forgot the list __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-h