I have to data frames, df_a and df_b with a different number of rows. Here is an example of my data structure.
df_a
id ident var
1 Test1
2 Test1
3 Test2
4 Test1
5 Test3
df_b
id ident var
1 Test1 26
2 Test2 59
Now I want to copy the df_b$var to df_a$var, but only if the ident is matched.
The result needs to look like this:
df_a
id ident var
1 Test1 26
2 Test1 26
3 Test2 59
4 Test1 26
5 Test3 NA
I'm not quite sure how to do this - may someone help?