[R] Simulation in R

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Sun Aug 4 10:38:35 CEST 2013


So you looked at some unspecified help pages online and tried some unspecified stuff? Try being more specific next time you post. For example, try reading the footer of any R-help email. Note that it says read the Posting Guide, and provide a reproducible example (at least of what you tried that didn't work). Also note that you need to use plain text email for your reproducible examples to get through the email system undamaged.

After reading the Posting Guide, the following hint may be of use:
?sample, prob argument.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

Preetam Pal <lordpreetam at gmail.com> wrote:
>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 at 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.



More information about the R-help mailing list