On Aug 17, 2012, at 8:28 PM, Yingwei Lee wrote:

m=matrix(c(1:4, c(0, 0, 0, 0), c(1, 0, 1, 1)), nc=4, byrow=TRUE)

is.na(m) <- m==0
rowMeans(m, na.rm=T)
#[1] 2.5 NaN 1.0

--
David Winsemius, MD
Alameda, CA, USA

______________________________________________
[email protected] 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