David Winsemius <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > > #-----toy code------- > rf1 <- function(n){rnorm(n,0,1)} ## normal distribution with mean=0 > rf2 <- function(n){rnorm(n,4,1)} ## normal distribution with mean=4 > rf3 <- function(n){rnorm(n,9,1)} ## normal distribution with mean=9 > S0 <- cbind(rf1(10),rf2(10),rf3(10)) > p1 <- 0.2; p2 <- 0.3; p3 <-0.5 > set.seed<-37
That doesn't do anything useful. set.seed(123) ...will result in an ix that has at least one of each of "1", "2", and "3", . > set.seed(5) > ix <- sample(c(1,2,3),10,prob=c(p1,p2,p3),replace=TRUE) > ix [1] 3 2 1 3 3 2 2 1 1 3 -- David Winsemius ______________________________________________ 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.