I'm trying to combine multiple data.frame()s in R in a similar fashion to rbind(), but when the new data.frame() is created, I'd like to know which of the original data.frame()s the data came from.
For example, if I have the following data:
Right eye
Vision    Colour    Prescription
  0.30    blue             -1.00
 -0.10    blue             +1.50
 (etc)    (etc)             (etc)
Left eye
Vision    Colour    Prescription
  0.00    blue             +1.00
  0.10    brown            -2.50
 (etc)    (etc)             (etc)
... I would like to end up with a data.frame() that looks like this:
Vision    Colour    Prescription      Eye
  0.30    blue             -1.00      Right
 -0.10    blue             +1.50      Right
  0.00    blue             +1.00      Left
  0.10    brown            -2.50      Left
melt() collapses the data to a long format, which I don't want. Using rbind() doesn't provide any clue as to where the data originally came from. What I need to do is have the extra column created that refers to the original source of the data (i.e. right and left in the example above).
I know this would be possible by adding an 'eye' column to each of the original data.frame()s and then using rbind(), but I wonder if there is a neater solution available?
 
     
    