Handling NA values
On 16-02-2013, at 18:55, Christofer Bogaso <bogaso.christofer at gmail.com> wrote:
Hello again, I have a question on who sum() handle the NA values.
sum(c(NA, 1), na.rm = TRUE)
[1] 1 I understand this. However could not agree with following:
sum(c(NA, NA), na.rm = TRUE)
[1] 0 Where this '0' is coming from? Should not it be NA itself?
sum(c()) [1] 0
sum(c(NA, NA), na.rm = TRUE)
is equivalent to sum(c()) or sum(NULL) or sum(integer(0). See the NB in the value section of the help page for sum. Berend