[R] sampling vectors

From: Eric Pante <ericpante_at_earthlink.net>
Date: Tue 04 Oct 2005 - 07:31:01 EST

Hello Listers,

I am trying to sample a vector to create a new one of sample length, witha sum equal to the sum of the initial vector:

initial = 10, 30, 10 (sum=50)
sample example = 5, 35, 10 (sum=50) or 25, 15, 10 (sum=50), etc ...

My problem is to control the sum, so it stays constant. Any suggestions would be very helpful !

Thank you in advance,
Eric



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 Tue Oct 04 07:35:49 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:35 EST