I have two dataframes:
Dataframe #1
A B C D E
2 1 0 5 7
and
Dataframe #2
C E F G
3 1 0 9
I would like to combine the two dataframes such that the 1st dataframe serves as the reference and the columns in common are added together
The solution should look like:
A B C D E
2 1 3 5 8
Notice the elements of the shared columns (columns C and E) were added and the extra columns in Dataframe #2 (columns F and G) were ignored because they were not found in Dataframe #1. Each Dataframe has a single row.
I have tried accomplishing this with the native functions in R as well as the merge package but I've had no luck. In my application I need to combine thousands of columns many of which are shared between the two dataframes so I'm working on developing a robust solution.
Thanks!