Work's for me:
sapply(unique(union(names(data1), names(data2))),
function(n)Reduce('+', m[grep(n, names(m))]))
1 2 3 4 5 6
[1,] 0.2481509 0.2481509 1.240754 0.7444526 0.00 0.9926034
[2,] 2.5269063 1.2634532 1.2
I've try it...
But don't work.
> data1
1 2 3 4 5 6
5 0.2481509 0.2481509 1.240754 0.7444526 0.00 0.9926034
102.5269063 1.2634532 1.263453 2.5269063 1.263453 2.5269063
150.000 6.6856351 3.342818
Try this:
> m <- merge(data1, data2, by = 0, all = TRUE, sort = FALSE)
> sapply(unique(union(names(data1), names(data2))), function(n)Reduce('+',
> m[grep(n, names(m))]))
On Wed, Jan 20, 2010 at 10:59 AM, Alfredo Alessandrini
wrote:
> Hi,
>
> I've this dataframes:
>
>> data1
> 1
Hi,
I've this dataframes:
> data1
12 3 4 56
50.4963017 0 0 0.2481509 1.9852069 0.4963017
10 0.000 0 0 0.000 0.6317266 0.000
15 0.000 0 0 0.000 0.000 0.000
20 0.000 0 0 3.3955301 0.000 0.
4 matches
Mail list logo