[R] sum() returns 0 not NA

will.eagle at gmx.net will.eagle at gmx.net
Tue Apr 20 18:42:21 CEST 2010


Dear all,

just a stupid R question, since the results puzzle me a bit:

> sum(c(NA,NA), na.rm=TRUE)
[1] 0
>  NA + NA   
[1] NA
> NA + 1
[1] NA
> 

Why does sum(c(NA,NA), na.rm=TRUE) return 0 and not NA?

Thanks in advance,

Will



More information about the R-help mailing list