I have a data frame df1
that looks like this:
id name type
46 hsa:4052 gene
50 hsa:7057 gene
52 hsa:8454 gene
And then I have a second data frame df2
that looks like this:
entry1 entry2 type name value
46 44 PPrel activation -->
52 50 PPrel activation -->
29 27 PPrel activation -->
Now the common columns in the two data frames are id from df1
and entry1
and entry2
from df2
. What i want my results to look like is this:
entry1 entry2 type name value
hsa:4052 44 PPrel activation -->
hsa:8454 hsa:7057 PPrel activation -->
29 27 PPrel activation -->
So what i want basically is replace the entry1
and entry2
id
s in df2
with the names of corresponding ids from df1
. I tried merge but obviously merge doesn't help here. Any help?