[R] generate randomly a value of a vector
Patrick Breheny
patrick.breheny at uky.edu
Thu Sep 8 14:15:45 CEST 2011
On 09/08/2011 04:42 AM, Boris Beranger wrote:
> I have a zero vector of length N and I would like to randomly allocate the
> value 1 to one of the values of this vector. I presume I have to use the
> uniform distribution but could someone tell me how I should process?
rmultinom(m,1,rep(1,N))
where m is the number of random vectors you wish to generate in this manner.
--
Patrick Breheny
Assistant Professor
Department of Biostatistics
Department of Statistics
University of Kentucky
More information about the R-help
mailing list