[Solved] R: Simple merge of 2 data frames [closed]


This is not really a merge so much as a concatenation, since you don’t have to worry about matching up by values in common columns:

dfA = read.table(text="    a   b   c
1   1   11  21
2   2   12  22
3   3   13  23
4   4   14  24
5   5   15  25")

dfB = read.table(text="    x   y   z
1   5   55  105
2   10  60  110
3   15  65  115
4   20  70  120
5   25  75  125")

dfC = cbind(dfA, dfB)

Output:

> dfC
  a  b  c  x  y   z
1 1 11 21  5 55 105
2 2 12 22 10 60 110
3 3 13 23 15 65 115
4 4 14 24 20 70 120
5 5 15 25 25 75 125

solved R: Simple merge of 2 data frames [closed]