Skip to content
Prev 66538 / 398502 Next

tapply and NA value

you should look at the 'na.rm=FALSE' argument of '?mean()', i.e.,

x <- rnorm(100); x[sample(100, 10)] <- NA
f <- sample(letters[1:5], 100, TRUE)
###############
tapply(x, f, mean)
tapply(x, f, mean, na.rm=TRUE)


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
     http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Leonardo Lami" <lami at faunalia.it>
To: <r-help at stat.math.ethz.ch>
Sent: Friday, March 25, 2005 10:35 AM
Subject: [R] tapply and NA value