RE: [R] constrained sample

2004-05-06 Thread Adaikalavan Ramasamy
Possible something like this ? > grp <- factor(rep(c("odd", "even"), 3)); val <- c(1,2,3,4,5,6) > data.frame(grp, val) grp val 1 odd 1 2 even 2 3 odd 3 4 even 4 5 odd 5 6 even 6 > ( newval.list <- tapply(val, grp, sample) ) $even [1] 6 4 2 $odd [1] 3 1 5 > for(i in 1:length(new

RE: [R] constrained sample

2004-05-06 Thread Lutz Prechelt
I'm afraid I do not understand what you need. What is sampled from where and what do you need to keep constant? And what is the relationship between the 'column' and the 'factor column'? Maybe you can provide a complete example and counterexample? Lutz > Is there an way to do a randomization (