Join two tables such that we get all rows from tableA and all columns of matching rows from tableB
I want to use data.table and not data.Frame. Please suggest the fastest method.
tableA <- data.table(column1 = c( 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9))
tableB <- data.table(column1 = c( 1.0, 1.2, 1.5, 1.9), column2 = c( "A", "B", "C", "D"), column3 = c( "AA", "BB", "CC", "DD"))
expected result:
column1 column2 column3
1: 1.0 A AA
2: 1.1 <NA> <NA>
3: 1.2 B BB
4: 1.3 <NA> <NA>
5: 1.4 <NA> <NA>
6: 1.5 C CC
7: 1.6 <NA> <NA>
8: 1.7 <NA> <NA>
9: 1.8 <NA> <NA>
10: 1.9 D DD