df <- data.frame(a = c(1, 1, NA, 0, 1, 0),
b = c(0, 1, NA, NA, 0, 1),
c = c(NA, 0, NA, 0, 1, NA),
d = c(1, NA, NA, 1, 1, 0))
rowSums(df)
#[1] NA NA NA NA 3 NA
rowSums(df, na.rm=T)
#[1] 2 2 0 1 3 1
The first I get, but my assumption and hope was that the third observation would return NA
. Is there a way to get it to return NA for the third observation?