I'm trying to add one data frame as rows to another data frame. The column names don't match, so I have a lookup table that matches them. I thought I would be able to do each column one at a time in a loop, but I keep getting replacement has 209 rows, data has 157
error.
How can I add them all at once? Here's an example of what I'm trying to do:
I've got two data sets
test1 = c("one", "two", "three", "four", "five")
test2 = c("1", "3", "4", "5")
And a lookup table to match the column names
first second
1 one 1
2 three 3
3 four 4
4 five 5
So I'd like to append all the rows from "1" into "one", "3" into "three" etc. I've tried a few different things and gotten errors either about the number of rows or the fact that I don't have replacements for each value, like in my example I'm ignoring the column "two".
Could anyone recommend how to do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…