2

I have two data.frames in a list, the first one has name "one", and the second one name "two"

data (mtcars)

xx <- list (one = mtcars [1:5, ],
            two = mtcars  [6:10, ])

I would like to bind the rows, simultaneously creating a new column, e.g. data.frame.name, it should contain values of "one" or "two" depending on if a particular row was from data.frame "one" or "two".

PS: naturally I need a solution for many data.frames, with different number of rows, the mtcars dataset is used as an example.

Pavel Shliaha
  • 773
  • 5
  • 16

0 Answers0