Thank you very much guys
On Sun, Aug 4, 2013 at 3:51 PM, Prof Brian Ripley <rip...@stats.ox.ac.uk>wrote: > On 04/08/2013 09:30, Rui Barradas wrote: > >> Hello, >> >> See the help page for ?sample. >> >> X <- sample(0:1, 10000, replace = TRUE, prob = c(0.25, 0.75)) >> >> Hope this helps, >> > > ?rbinom would have been a better answer since simpler, faster, algorithms > are available in that case. > > Or even > > as.integer(runif(10000) < 0.75) > > > Rui Barradas >> >> Em 04-08-2013 08:51, Preetam Pal escreveu: >> >>> Hi All, >>> >>> >>> I want to simulate a random variable X which takes values 1 and 0 with >>> probabilities 75% and 25% respectively and then repeat the procedure >>> 10000 >>> times. >>> >>> I am sure this is trivial, I tried to look at the help pages online, >>> but I >>> can't quite find it. >>> >>> Appreciate your help. >>> >>> Thanks and Regards, >>> Preetam >>> >> > > -- > Brian D. Ripley, rip...@stats.ox.ac.uk > Professor of Applied Statistics, > http://www.stats.ox.ac.uk/~**ripley/<http://www.stats.ox.ac.uk/~ripley/> > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UK Fax: +44 1865 272595 > -- Preetam Pal (+91)-9432212774 M-Stat 2nd Year, Room No. N-114 Statistics Division, C.V.Raman Hall Indian Statistical Institute, B.H.O.S. Kolkata. [[alternative HTML version deleted]] ______________________________________________ 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.