[R] return NA instead zero when summing over an empty range?

Martin Ivanov tramni at abv.bg
Wed Oct 27 12:08:58 CEST 2010


 Dear R users,

the colSums function from the base package returns zero if there are no values in a range to be summed over (after removing missing values with na.rm = TRUE). Is there some way to make it return NA in that case just like colMeans does? Or any other function or some good way to achieve that? Any ideas are be welcome.

Regards,
Martin Ivanov

-----------------------------------------------------------------
Вижте последните новини във Vesti.bg!
http://www.vesti.bg/



More information about the R-help mailing list