Jim Lemon
2015-Jan-26 22:41 UTC
[R] Sum function and missing values --- need to mimic SAS sum function
Hi, To those who pointed out my mistake, thanks. Using ifelse may not return a sensible arithmetic sum. Jim
JSHuang
2015-Jan-27 18:43 UTC
[R] Sum function and missing values --- need to mimic SAS sum function
Hi, Not sure if the following is what you look for:>x <- c(1:10, NA, 12:20) >sum(x[!is.na(x)])-- View this message in context: http://r.789695.n4.nabble.com/Sum-function-and-missing-values-need-to-mimic-SAS-sum-function-tp4702344p4702392.html Sent from the R help mailing list archive at Nabble.com.