Re: [Rd] R 'base' returning 0 as sum of NAs

2017-02-09 Thread Hervé Pagès
On 01/11/2017 02:33 AM, Alex Ivan Howard wrote: There is nothing to sum over, so it shouldn't actually be able to return a concrete numeric value? How much did you spend at the grocery store if you didn't buy anything? H. __ R-devel@r-project.org

Re: [Rd] R 'base' returning 0 as sum of NAs

2017-01-11 Thread Duncan Murdoch
On 11/01/2017 5:33 AM, Alex Ivan Howard wrote: Dear R Team The following line returns 0 (zero) as answer: sum(c(NA_real_, NA_real_, NA_real_, NA_real_), na.rm = TRUE) One would, however, have expected it to return 'NaN', as is the case with function 'mean': mean(c(NA_real_, NA_real_,

[Rd] R 'base' returning 0 as sum of NAs

2017-01-11 Thread Alex Ivan Howard
Dear R Team The following line returns 0 (zero) as answer: sum(c(NA_real_, NA_real_, NA_real_, NA_real_), na.rm = TRUE) One would, however, have expected it to return 'NaN', as is the case with function 'mean': > mean(c(NA_real_, NA_real_, NA_real_, NA_real_), na.rm = TRUE) [1] NaN The problem