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:
col1sample<-sample(col1,2,replace=T)
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:
col1sample<-sample(col1,2,replace=T)
col2selection<-col2[col1==col1sample]
col2sample<-sample(col2selection,2,replace=T)
Does it make sense?
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.