[R] random generation of a factor

From: Christian Bieli <christian.bieli_at_gmx.ch>
Date: Mon 22 May 2006 - 18:53:29 EST


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 
status                 
major    2             
minor    2.0           
year     2005          
month    10            
day      06            
svn rev  35749         

language R

Thanks a lot.
Christian



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon May 22 20:10:11 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 22 May 2006 - 22:10:16 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.