Hi all,

I'm looking for some help to bias the sample function. Basically, I'd like
to generate a data frame where the first column is completely random, the
second, however, is conditional do the first, the third is conditional to
the first and the second and so on. By conditional I mean that I shouldn't
have repeated values in the line. I know it could be easily implemented
using permutation, but it is not the case here. I need at least five
columns. Any idea to achieve what do I need?


set.seed(51)
 data <- data.frame(
     id=as.factor(1:100),
     a=as.factor(sample(1:10, size=100, replace=TRUE)),
     b=as.factor(sample(1:10, size=100, replace=TRUE)),
     c=as.factor(sample(1:10, size=100, replace=TRUE)),
     d=as.factor(sample(1:10, size=100, replace=TRUE)),
     e=as.factor(sample(1:10, size=100, replace=TRUE))
)

______________________________________________
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.

Reply via email to