So for a project I'm working on at the moment, I have a data frame of numbers (call it A). The data.frame A consists of 1 variable and 300000 rows of distinct numbers.
Besides from A, I have data.frame B and C. Data frame B and C both have 315 variables and share the same structure (have the same datatypes BUT different values/ variable names).
A, B and C all share the same first variable, which is the primary key of them all. A contains the entire list of numbers and B and C both contain a subset of this list.
What I want to do, is match the numbers in the first variable in B and C to the ones in A, if they match then all the data of the belonging row in B and C should get put into A.
In SQL I know that you can update a table and add rows based on the results where it matches. However, I'm not allowed to use any SQL commands in this assignment (so I can't use the sqldf library) and I have no clue how to do this in R.
As an example, lets say you have the following data frames with info:
A.
KEY
1
2
3
4
5
6
7
B.
B_KEY VAR_B_2 VAR_B_3
2 AB 134
4 AC 135
7 AD 136
C.
C_KEY VAR_C_2 VAR_C_3
2 BD 250
3 BE 251
5 BF 252
7 BG 253
This should result into:
A.
KEY VAR_B_2 VAR_B_3 VAR_C_2 VAR_C_3
1
2 AB 134 BD 250
3 BE 251
4 AC 135
5 BF 252
6
7 AD 136 BG 253