On 16-02-2013, at 18:55, Christofer Bogaso <bogaso.christo...@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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.