Re: [R] subsampling table

2010-11-09 Thread Henrique Dallazuanna
Try this: > x V1 V2 V3 1 1 15 34 2 1 4 66 3 1 24 65 4 2 23 47 5 2 9 36 6 3 58 9 7 3 38 64 8 3 12 64 9 3 4 15 10 4 1 88 11 4 23 90 x[tapply(seq(nrow(x)), x$V1, sample, 1),] On Tue, Nov 9, 2010 at 9:01 PM, Achim Eberhart < a.eberh...@pgrad.unimelb.edu.au> wrote: > G'

[R] subsampling table

2010-11-09 Thread Achim Eberhart
G'day R-helpers, I want to subsample rows of a large table based on the value in its first column. Of all rows sharing the same value in the first column I want to RANDOMLY extract only one. Thanks in advance, Achim example input 1 15 34 1 4 66 1 24 65 2