[R] Mean rain per rain day

Jim Lemon drjimlemon at gmail.com
Wed May 13 14:08:30 CEST 2015


Hi Frederic,
It looks like you have a number of daily rainfall values and you want
to get the mean rainfall on days where there was some rain. What you
probably want is:

daily_rainfall<-rpois(50,2)
mean(daily_rainfall[daily_rainfall>0])

You may have to add na.rm=TRUE if there are NAs in your data.

Jim


On Wed, May 13, 2015 at 4:38 PM, Frederic Ntirenganya <ntfredo at gmail.com> wrote:
> Hi All,
>
> I want to compute Mean rain per rain day from rainfall data but i don't
> know how to go about that. Anyone who understand the approach I can use can
> help me. In addition, I would like to have RScript which can help me to
> compute it. thanks.
>
> Regards,
> Frederic.
>
> Frederic Ntirenganya
> Maseno University,
> African Maths Initiative,
> Kenya.
> Mobile:(+254)718492836
> Email: fredo at aims.ac.za
> https://sites.google.com/a/aims.ac.za/fredo/
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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