[R] Get median of each column

Stephan Kolassa Stephan.Kolassa at gmx.de
Wed Jan 28 20:39:09 CET 2009


Assuming your data are in a data.frame called dataset,

apply(dataset,2,median)

should work. Look at

?apply

HTH,
Stephan


Frank Zhang schrieb:
> I am new to R. How can I get column median? Thanks.Frank
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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