[R] Merge data frames but prefer values in one
jo
jo.lists at gmail.com
Fri Sep 11 08:45:14 CEST 2009
Thanks for the post-processing ideas. But is there any way to do that
in one step?
On Thu, Sep 10, 2009 at 7:20 PM, Henrique Dallazuanna <wwwhsd at gmail.com> wrote:
>
> Try this:
>
> xy <- merge(x, y, by = c("a","b"),all = TRUE)
> xy$c <- ifelse(rowSums(!is.na(.x <- xy[, c('c.x', 'c.y')])) > 1, .x[,1], rowSums(.x, na.rm = TRUE))
> xy
>
> On Thu, Sep 10, 2009 at 12:21 PM, JiHO <jo.lists at gmail.com> wrote:
JiHO
---
http://maururu.net
More information about the R-help
mailing list