I am trying to make some sort of loop using R, where the loop searches for a spesific value from a column in df1 in a column in another dataframe(df2), and returns a value from the next column if the value is found in df3.
A simple example of df1, df2 and the wanted result in df3 is illustrated below. I would greatly appreciate some help with this, as i am not very experienced in R and thus have a hard time figuring out loops..
> df1
Col1
A
B
C
D
E
F
G
> df2
Col1 Val1
A 1
B 3
B 5
H 3
E 7
G 2
K 9
G 1
> df3
Col1 Val1
A 1
B 3
B 5
E 7
G 2
G 1