[R] Using transform to add a date column to a dataframe

Tom La Bone booboo at gforcecable.com
Tue Dec 23 14:24:04 CET 2008

I would like to add a column to the airquality dataset that contains the date
1950-01-01 in each row. This method does not appear to work:

> attach(airquality)
> data1 <- transform(airquality,Date=as.Date("1950-01-01"))

Error in data.frame(list(Ozone = c(41L, 36L, 12L, 18L, NA, 28L, 23L, 19L,  : 
  arguments imply differing number of rows: 153, 1
I can't decipher what the error message is trying to tell me. Any
suggestions on how to do this?

View this message in context: http://www.nabble.com/Using-transform-to-add-a-date-column-to-a-dataframe-tp21144414p21144414.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list