[R] Sampling given a table of percentages?

Ben Hyde bhyde at pobox.com
Wed Feb 16 17:39:52 CET 2005


I have a vector V.  sum(V) = 100, i.e. it's percentages.  length(V) is 
large.  I wish to generate samples (with replacement is fine), 
integers, in the range 1:length(V) who's distribution is driven by the 
distribution implied by the percentages in V.    V is unsorted, but 
that could change.  I'd rather not be too specific about the 
distribution of V.    I can certainly solve the problem intersecting my 
thin knowledge of R with my skills in programming, but I suspect this 
is trivial to somebody fluent in R.   Suggestions?  Thanks!  - ben

----
http://enthusiasm.cozy.org/   -- blog
tel:+1-781-240-2221  -- mobile, et.al.




More information about the R-help mailing list