Skip to content
Prev 157007 / 398506 Next

rowSums()

On 9/24/2008 10:06 AM, Doran, Harold wrote:
I don't know if it is "proper", but here is a slightly different way
that I find easier to read:

apply(testDat, 1, function(x){
ifelse(all(is.na(x)), NA, sum(x, na.rm=TRUE))
})

[1]  1 NA  6

hope this helps,

Chuck