I have two data frames, df1
and df2
. df1
contains positions and gene names assigned to those positions e.g.
Name V1
Gene_1 +1110
Gene_2 +2600
Gene_3 +3600
Gene_4 -2600
Gene_5 -4000
Gene_6 -3500
Gene_7 +2900
.....
Whereas df2
just contains the V1 column.
V1
+1110
+3600
-4000
-3500
+2900
....
+6000
-7000
....
What I am wanting to do is to loop through df1
so I am able to extract the matching 'Name' to 'V1' and output it df2
in a new column. Does anyone know how to do this?
My output should look like this:
V1. Name
+1110 Gene_1
+3600 Gene_3
-4000 Gene_5
-3500 Gene_6
+2900 Gene_7
.... ......
+6000 Gene_13
-7000 Gene_16
.... ......