I have two data frames. For example the df1
looks like:
Name Month Number
1.H 1 8
2.H 2 7
3.H 3 6
4.A 1 9
5.A 2 10
6.A 3 11
And df2
looks like:
Name Month index
1.H 1 3
2.H 2 2
3.H 3 1
4.A 1 3
5.A 2 5
6.A 3 9
And I want to merge it to the following df
:
Name Month Number index
1.H 1 8 3
2.H 2 7 2
3.H 3 6 1
4.A 1 9 3
5.A 2 10 5
6.A 3 11 9
How can I merge the two df's to this df
?
I have already tried the merge
function by.x
and by.y
but that only allows merging by one column, but I want also the second column.