I have 3 data frames in R lets say:
df1 <- data.frame(x = 1:5, y = 1:5)
df2 <- data.frame(x = 1:6, y = 1:6)
df3 <- data.frame(x = 1:4, y = 1:4)
and I would like to merge them together to create a new data frame that would have as first column the name of the data frame for each row of that data frame. I would look like this:
df x y
1 df1 1 1
2 df1 2 2
3 df1 3 3
4 df1 4 4
5 df1 5 5
6 df2 1 1
7 df2 2 2
8 df2 3 3
9 df2 4 4
10 df2 5 5
11 df2 6 6
12 df3 1 1
13 df3 2 2
14 df3 3 3
15 df3 4 4
Any ideas? Thank you in advance.