I have several data frames that I want to combine by row. In the resulting single data frame, I want to create a new variable identifying which data set the observation came
Another workaround for this one is using ldply in the plyr package...
df1 <- data.frame(x = c(1,3), y = c(2,4)) df2 <- data.frame(x = c(5,7), y = c(6,8)) list = list(df1 = df1, df2 = df2) df3 <- ldply(list) df3 .id x y df1 1 2 df1 3 4 df2 5 6 df2 7 8