Hello, See the help page for ?sample.
X <- sample(0:1, 10000, replace = TRUE, prob = c(0.25, 0.75)) Hope this helps, 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 [[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.
______________________________________________ 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.