Re: [R] function for rowMedian?

From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>
Date: Sat 21 Jan 2006 - 02:39:21 EST

Max Kauer wrote:
> Hi
> is anybody aware of a function to calculate a the median for specified
> columns in a dataframe or matrix - so analogous to rowMeans?
> Thanks
> Max
>
> --
>

No equivalent in base R, but you could always use ?apply:

apply(x, 1, median)

assuming "x" is an array or is coercible to a array.

I have a C-function that does this as part of my personal R package (not available from CRAN). It has the same time savings as "rowMeans" has over apply(x, 1, mean). Contact me offline if you would like a copy.

HTH, --sundar



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jan 21 02:57:33 2006

This archive was generated by hypermail 2.1.8 : Sat 21 Jan 2006 - 06:23:04 EST