Apologies for a probably basic question but I can't seem to work out how to get this to work...
I want to add a row vector to an existing data frame. However, often the new row will have more columns than the existing data frame and I would like to fill the missing column entries with NA or blank strings.
For example, using this set up:
existing <- data.frame(rbind(letters[1:5], letters[6:10]))
new_row <- letters[20:26]
I would like to end up with the following:
a b c d e "" ""
f g h i j "" ""
t u v w x y z
The rbind function only accept equal width vectors. I have heard of rbind.fill from the plyr package but this only works for two data frames. Does anyone have a simple way to do this?
Many thanks Adrian