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 www...@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],
Maybe:
do.call(rbind, lapply(with(xy - rbind(x, y), split(xy, list(a, b), drop =
TRUE)), tail, 1))
On Fri, Sep 11, 2009 at 3:45 AM, jo jo.li...@gmail.com wrote:
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
Hello everyone,
My problem is better explained with an example:
x=data.frame(a=1:4,b=1:4,c=rnorm(4))
x
a b c
1 1 1 -0.8821089
2 2 2 -0.7082583
3 3 3 -0.5948835
4 4 4 -1.8571443
y=data.frame(a=c(1,3),b=3,c=rnorm(2))
y
a bc
1 1 3 -0.273155973
2 3 3 0.009517862
Now I
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.li...@gmail.com wrote:
Hello everyone,
My problem is better explained with an example:
4 matches
Mail list logo