Skip to content

Combine data frames using column names as "key"

2 messages · jimineep, Henrique Dallazuanna

#
Hi guys,

Suppose I have 2 data frames ie:
         values
one    0.32
two    0.25
three  0.11

and 
         values
two    0.66
one    0.74
three  0.19

nb the first column is the row names in both cases

How can I combine them on the row names column? Ie to make something like


         values.1 values.2
one    0.32       0.74
two    0.25       0.66
three  0.11       0.19

I guess its data.frame or c.bind but I keep getting errors when I try to
combine them on row names...

Many many thanks,

Jim
#
Try:

data.frame(merge(df1, df2, by = "row.names"), row.names = 1)
On Mon, Sep 22, 2008 at 12:34 PM, jimineep <jamesrperkins at hotmail.com> wrote: