[R] NAs

ben@zoo.ufl.edu ben at zoo.ufl.edu
Wed Sep 13 14:07:59 CEST 2000


  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:

> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> 
> 

-- 
318 Carr Hall                                bolker at zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list