Sorry, never mind - I have to use rowSums with na.rm=T Dimitri On Fri, Aug 5, 2011 at 2:01 PM, Dimitri Liakhovitski <dimitri.liakhovit...@gmail.com> wrote: > Hello! > > I have a data frame with some NAs. > test<-data.frame(a=c(1,2,NA),b=c(10,NA,20)) > > I need to sum up values in 2 variables. However: > test$a+test$b > procudes NAs in rows that have NAs. > > How could I sum up columns while ignoring NAs (the way the function > sum(..., na.rm=T) works? > Thank you! > -- > Dimitri Liakhovitski > marketfusionanalytics.com >
-- Dimitri Liakhovitski marketfusionanalytics.com ______________________________________________ R-help@r-project.org mailing list 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.