# it's not clear what your question is, but here's a stab in the dark at a
solution!

ind<- !is.na(dataframe$A) & !is.na(dataframe$B)
dataframe$A[ind] + dataframe$B[ind] 

- Dan

P.S. I'm sure there are ways to do this using one of R's functions for
automatically removing NA's (na.rm = T), but unless you use them all the
time, their behavior is not always predictable (e.g., sometimes it ignores a
whole row with one NA in it; sometimes it treats NAs as zeros). Explicitly
defining  the indices that you want to exclude may make it easier to avoid
difficult-to-find errors.
 



--
View this message in context: 
http://r.789695.n4.nabble.com/Handling-NA-in-summation-tp4711923p4711932.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to