[R] month-day-year to Date

Gabor Grothendieck ggrothendieck at gmail.com
Sun Dec 28 20:21:58 CET 2008


I would use paste but as.Date(ISOdate(...)) is another possibility although
it uses paste internally itself.

On Sun, Dec 28, 2008 at 2:11 PM, Terry Therneau <therneau at mayo.edu> wrote:
>  I have a data from with 3 numeric variables, and wish to create a Date object.
> The old "date" library had a function mdy.date to do this.  I've chased all of
> the See Also sections I can find for the Date class, and didn't find anything
> comparable.
>
>  Yes, I can use as.Date(paste(data$year+1900, data$month, data$day), sep='/'))
> but it seems odd pack something together that will immediately be unpacked.
>
>        Terry Therneau
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list