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
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
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
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
5 35
5 45
I used sample(unique(ID)) to select a sample if ID's, say, (1,4,5). Now
I want to pull out the rows with ID's 1, 4, a