[R] Get median of each column
Stephan Kolassa
Stephan.Kolassa at gmx.de
Wed Jan 28 21:28:00 CET 2009
Thank you, Rolf, for this well-deserved spanking :-)
I promise to amend my ways and think before I send in the future.
Best,
Stephan
Rolf Turner schrieb:
>
> On 29/01/2009, at 8:39 AM, Stephan Kolassa wrote:
>
>> Assuming your data are in a data.frame called dataset,
>>
>> apply(dataset,2,median)
>>
>> should work. Look at
>>
>> ?apply
>
> Note that apply() works with ***matrices***. The foregoing code will
> work, given that all columns of ``dataset'' are numeric, due to the
> fact that apply will *coerce* a data frame to a matrix.
>
> However it should always be remembered that
>
> DATA FRAMES ARE NOT MATRICES!!!
>
> cheers,
>
> Rolf Turner
>
> ######################################################################
> Attention: This e-mail message is privileged and confidential. If you
> are not the intended recipient please delete the message and notify the
> sender. Any views or opinions presented are solely those of the author.
>
> This e-mail has been scanned and cleared by MailMarshal
> www.marshalsoftware.com
> ######################################################################
>
More information about the R-help
mailing list