Try this: colSums(rbind(a, b[1:length(a)]), na.rm = TRUE)
On Sat, Sep 19, 2009 at 8:30 PM, Henrik Kallberg <henrik.kallb...@ki.se> wrote: > Hi all! > I'm stuck with this "easy" problem. I have two tables (a and b) which i > would like to add. table a looks like: > a > var1 var2 > 3 4 > and table b looks like: > b > var1 > 10 > I would like this result: c<- a+b > c > var1 var2 > 13 4 > Best regards Henrik Källberg > > ______________________________________________ > 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. > > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ 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.