search for: new_1

Displaying 1 result from an estimated 1 matches for "new_1".

Did you mean: new1
2010 Feb 17
3
Extending data frame with longer columns
...w chapters in the R book, I was not able to find a solution for this simple problem. I have an empty data frame: a=data.frame(name="test") which I would like to extend in a for-loop (with data extracted from a database). Ideally I would like to extend the data frame like this: a["new_1"] = 1:10 a["new_1"] = 1:12 a["new_1"] = 1:14 R now obviously complains about the changing length of the new columns. However, I would like to have missing values being added whenever columns are shorter than a newer (longer) column. How can I do that? Thanks, Ralf