[R] sum(is.na(c(...)) -> negative number; bug or feature?

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon May 24 21:56:42 CEST 1999


Barnet Wagman <wagman at enteract.com> writes:

> > sum(is.na(c(1,NA,3)))
> [1] -1
> 
> (This is from R Version 0.64.0, under Redhat Linux 5.2 (compiled from
> scratch
>  using egcs-g77-1.0.3a-14, although I can't imagine that's relevant).
> 
> Is this a bug, or is there something about sum() that I'm missing?

Bug in is.na(), fixed in 0.64.1.

Apparently, POSIX only specifies that isnan() returns nonzero on NaN's
and RH5.2 took that literally...

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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