(I come from a SAS background where one can set an index column.)
Suppose I have the following code:
a <- 11:20
b <- 101:110
c <- 131:140
abc <-data.frame(a, b, c)
abc
I expect to get the following:
a b c
1 11 101 131
2 12 102 132
3 13 103 133
4 14 104 134
5 15 105 135
6 16 106 136
7 17 107 137
8 18 108 138
9 19 109 139
10 20 110 140
Suppose that I run a function from some analytical package that gives me back a column "a" along with a
new column "d" but deletes two of the rows. The package keeps the original row number, even though two
rows were omitted. Let's call the new data frame xyz.
a d
1 11 3
2 12 32
3 13 2
4 14 5
5 15 8
7 17 21
8 18 1
10 20 13
Now I want to merge abc with xyz based on the 8 index value, so that I get this:
a b c d
1 11 101 131 3
2 12 102 132 32
3 13 103 133 2
4 14 104 134 5
5 15 105 135 8
7 17 107 137 21
8 18 108 138 1
10 20 110 140 13
How can that be accomplished?
Thanks!
Andrew