I'd like to merge a bunch of data frames together (because it seems many operations are easier if you're only dealing w/ one, but correct me if I'm wrong).
Currently I have one data frame like this:
ID, var1, var2
A, 2, 2
B, 4, 5
.
.
Z, 3, 2
Each ID is on a single row w/ several single measurements
I also have a csv file w/ repeated measurement for each ID, like:
filename = ID_B.csv
time, var4, var5
0, 1, 2
1, 4, 5
2, 1, 6
...
What I'd like is:
ID, time, va1, var2, var4, var5
...
B, 0, 4, 5, 1, 2,
B, 1, 4, 5, 4, 5,
B, 2, 4, 5, 1, 6,
...
I don't really care about the column order. The only solution I can think of is to add the ID column to each csv file then loop through them calling merge()
several times. Is there a more elegant approach?