if your matrix has many rows you might want to consider rowMedians from Bioconductor package Biobase.
hth,
Matthias

Greg Hirson schrieb:
Edward,

See ?apply

x = matrix(rnorm(100), ncol = 10)
apply(x, 1, median)

Hope this helps,

Greg

Edward Chen wrote:
Hi,

I tried looking through google search on whether there's a way to computer the median for each row of a nxn matrix and return the medians for each row
for further computation.
And also if the number of columns in the matrix are even, how could I
specify which median to use?

Thank you very much!



--
Dr. Matthias Kohl
www.stamats.de

______________________________________________
R-help@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.

Reply via email to