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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to