[R] random generation of a factor

Christian Bieli christian.bieli at gmx.ch
Mon May 22 10:53:29 CEST 2006

Hi everybody

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 be too hard 
to write it for myself, but if there's a preexisting one..
I searched the documentation and the help archive, but could not find 
anything helpful.

 > version
platform i386-pc-mingw32
arch     i386          
os       mingw32       
system   i386, mingw32 
major    2             
minor    2.0           
year     2005          
month    10            
day      06            
svn rev  35749         
language R

Thanks a lot.

More information about the R-help mailing list