[R] counting values with some conditions in a simulation

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Fri Nov 25 16:19:41 CET 2011

You need to read the posting guide. Provide a reproducible code sample, simplified, with self-contained data.
You might find the "ave" function useful if you are working with vectorized simulations.
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.

Sl K <s.karmv at gmail.com> wrote:

>Dear R users,
>I am running simulations (1000), and in my simulation I am looking at
>specific sums. For example, if the sum is >=4 then count this, if say
>then don't count, if the sum=3, then generate a random number from
>distribution, if this number is say less than 0.5, then count this sum,
>greater than 0.5, then don't count. I am having trouble with
>this uniform number and decide whether to count 3 or not.  Any help or
>will be greatly appreciated. Thank you very much in advance
>	[[alternative HTML version deleted]]
>R-help at r-project.org mailing list
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list