[R] once more: methods on missing data

Achim Zeileis zeileis at ci.tuwien.ac.at
Thu Jun 7 17:39:09 CEST 2001

> The result of the call
>      x <- as.numeric(c(NA,NA,NA)); STATISTIC(x[!is.na(x)])
> depends on the STATISTIC.
>      STATISTIC           RESULT
>      min                 Inf and warning message
>      max                 -Inf and warning message
>      mean                NaN and no warning message
>      quantile            named vector containing NAs and no warning message
>      sd                  abortion of the evaluation with an error message

OK, now I see your problem. R 1.2.3 gives the following for your

> sd(x[!is.na(x)])
Error in var(x, na.rm = na.rm) : `x' is emptyplatform

but this seems to be fixed in the current development version (the
forthcoming R 1.3.0)

> sd(x[!is.na(x)])
[1] NA

I'm not sure, what difference in the code is responsible for this but I
hope this helps. My respective systems are given below.

Achim Zeileis
Institut für Statistik
Technische Universität Wien

platform sparc-sun-solaris2.7
arch     sparc               
os       solaris2.7          
system   sparc, solaris2.7   
major    1                   
minor    2.3                 
year     2001                
month    04                  
day      26                  
language R   

platform i686-pc-linux-gnu           
arch     i686                        
os       linux-gnu                   
system   i686, linux-gnu             
status   Under development (unstable)
major    1                           
minor    3.0                         
year     2001                        
month    03                          
day      20                          
language R
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