Skip to content
Prev 157010 / 398506 Next

rowSums()

try the following:

testDat <- data.frame(A = c(1,NA,3), B = c(NA, NA, 3))

ind <- rowSums(is.na(testDat)) == length(testDat)
out <- rowSums(testDat, na.rm = TRUE)
out[ind] <- NA
out


I hope it helps.

Best,
Dimitris
Doran, Harold wrote: