Hi,

> 
> Does anybody know a function that generates a factor of 
> length N with K 
> levels given the proportions c(p1, p2,... ,pk)? It would not 

## does this code piece help you?

mydata <- c("yesterday", "today", "tomorrow")
myproportions <- c(0.3, 0.5, 0.2)

n <- 20
sample(x=mydata, size=n, replace=TRUE, prob=myproportions)

cat("Best,\nRoland\n")

----------
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to