Skip to content

NAs

2 messages · Pesl Thomas, Ben Bolker

#
Dear R-Friends,

i encountered the following problem:

i wanted to apply(x,2,mean), where x is an array (3720 x 90), every single
column has a certain number of NAs, so the output of apply is a vector of
NAs. 
Is there a possibility (other than reducing every single column with
na.omit()) to deal with this.

Thanks,
    Thomas
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
I suspect that apply(x,2,mean,rm.na=TRUE) will do what you want.
("na.rm" is an optional argument to mean -- see ?mean.  sd() has a similar
option.)
On Wed, 13 Sep 2000, Pesl Thomas wrote: