[R] any other fast method for median calculation

roger koenker rkoenker at uiuc.edu
Tue Apr 14 14:28:21 CEST 2009


There is a slightly faster algorithm in my quantreg package, see  
kuantile()
but this is only significant when sample sizes are very large.  In  
your case
you really need a wrapper that keeps the loop over columns within some
lower level language.

url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker at uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820



On Apr 13, 2009, at 11:29 PM, Zheng, Xin (NIH) [C] wrote:

> Hi there,
>
> I got a data frame with more than 200k columns. How could I get  
> median of each column fast? mapply is the fastest function I know  
> for that, it's not yet satisfied though.
>
> It seems function "median" in R calculates median by "sort" and  
> "mean". I am wondering if there is another function with better  
> algorithm.
>
> Any hint?
>
> Thanks,
>
> Xin Zheng
> ______________________________________________
> R-help at r-project.org mailing list
> 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