[R] Conditional sampling?

Olga Lyashevska olga at herenstraat.nl
Thu Feb 4 14:40:55 CET 2010

Thanks Thierry!

On 04.02.2010, at 13:22, ONKELINX, Thierry wrote:

> selection <- subset(somedf, col1 != "a")
> sample(selection$col2, 2, replace = TRUE)

I simplified it, but in fact it is not only 'a' to be eliminated, but  
thousands of  rows.

Can I use:

selection <- subset(somedf, col1= col1sample) # why do we say here  
somedf, cant we just restrict our condition to one row only?

I was also thinking of doing something like:


Does it make sense?

More information about the R-help mailing list