[R] changing date format in a dataframe

R. Michael Weylandt michael.weylandt at gmail.com
Wed Nov 16 16:25:05 CET 2011


Can you dput() your data frame? There are a different few time objects
in R and details might depend which one you have. Though, if it's
printing like that, I'd guess it's actually a string that you can
convert to a Date using as.Date(, format = XXX) where you can work out
the formatting from the documentation in ?strptime.

Michael

On Wed, Nov 16, 2011 at 9:12 AM, arunkumar1111 <akpbond007 at gmail.com> wrote:
> Hi
>
> I have a data frame and i need to change the date format in it.
> my dataframe
>
> X Date
> 1 1/1/2009
> 2 2/1/2009
> 3 3/1/2009
>
> I need to change it to 2009-01-01
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/changing-date-format-in-a-dataframe-tp4076411p4076411.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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