[R] Calculating mean, median, minimum, and maximum

Henrik Bengtsson hb at biostat.ucsf.edu
Fri Dec 19 18:35:23 CET 2014


On Fri, Dec 19, 2014 at 8:48 AM, John Kane <jrkrideau at inbox.com> wrote:
> Hi,
> It looks like you are replying to some phantom. Is your correspondent actully on R-help?

This most likely happens because OP posted the message via Nabble
[http://r.789695.n4.nabble.com/Calculating-mean-median-minimum-and-maximum-td4700862.html]
via "New Topic", which in turn post the message to r-help after asking
the user to confirm:

"Mailing List Subscription Reminder
This forum is an archive/gateway which will forward your post to the
r-help at r-project.org mailing list.

The mailing list may require your subscription before accepting your
post. Please note that being registered with Nabble does NOT
automatically subscribe you to this mailing list. If you haven't
subscribed yet, please do it now. If you aren't sure or don't
remember, just subscribe again because there is no harm."

Since OP is not a registered user on the r-help mailing list, his/her
post is help by r-help for moderation.  However, mtrang probably saw
it on Nabble and replied there and since mtrang is also a registered
user on the r-help, his/her messages reach us here on r-help, before
OP's messages help for moderation are approved.

I'd say, this is quite annoying "feature" to everyone but Nabble
users, particularly since the Nabble message does not include the
previous messages (unlike email).

/Henrik

>
> John Kane
> Kingston ON Canada
>
>
>> -----Original Message-----
>> From: mtrang at buffalo.edu
>> Sent: Fri, 19 Dec 2014 08:08:29 -0800 (PST)
>> To: r-help at r-project.org
>> Subject: Re: [R] Calculating mean, median, minimum, and maximum
>>
>> You can use the apply function which "applies" a function of your choice,
>> and
>> MARGIN = 2 means you want to do it columnwise:
>>
>>> apply(X = df, MARGIN=2, FUN = mean, na.rm = TRUE)
>>  Latitude Longitude   January  February     March     April       May
>> June
>>   26.9380 -109.8125  159.8454  156.4489  153.6911  150.1719  148.0885
>> 149.2365
>>> apply(X = df, MARGIN=2, FUN = min, na.rm = TRUE)
>>  Latitude Longitude   January  February     March     April       May
>> June
>>    26.938  -110.688   121.204   118.713   117.293   114.398   112.357
>> 113.910
>>> apply(X = df, MARGIN=2, FUN = max, na.rm = TRUE)
>>  Latitude Longitude   January  February     March     April       May
>> June
>>    26.938  -108.938   252.890   248.991   244.870   241.194   239.615
>> 239.888
>>> apply(X = df, MARGIN=2, FUN = median, na.rm = TRUE)
>>  Latitude Longitude   January  February     March     April       May
>> June
>>   26.9380 -109.8120  134.5990  130.7960  127.4495  123.2100  120.8375
>> 122.3835
>>
>>
>>
>> --
>> View this message in context:
>> http://r.789695.n4.nabble.com/Calculating-mean-median-minimum-and-maximum-tp4700862p4700946.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> 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.
>
> ____________________________________________________________
> FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
> Visit http://www.inbox.com/photosharing to find out more!
>
> ______________________________________________
> 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