An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101027/863c1273/attachment.pl>
Generate random percentages and placing vectors
5 messages · David Winsemius, Jonathan P Daily, Aaron Lee +1 more
On Oct 27, 2010, at 11:02 AM, Aaron Lee wrote:
Hello everyone, I have two questions: 1.) I would like to generate random percentages that add up to 100. For example, if I need 5 percentages, I would obtain something like: 20, 30, 40, 5, 5. Is there some way to do this in R? 2.) I would like to insert vectors of specified length into a larger vector of specified length randomly, and fill the gaps with zeroes. For example, if I have 3 vectors of length 3, 2, and 2 with values and I would like to randomly place them into a vector of length 25 made of 0's.
You need to specify the order of placement and whether over-writing is allowed. If overwriting is not allowed then after the first is placed the allowable positions may shrink in odd ways.
Thank you in advance!
David Winsemius, MD West Hartford, CT
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101027/bd102cd3/attachment.pl>
1 day later
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101028/971938aa/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20101028/d22500bb/attachment.pl>