Le mercredi 16 novembre 2011 à 06:12 -0800, arunkumar1111 a écrit :
> 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
See ?as.Date. In your case, I think you should use
df[[2]] <- as.Date(df[[2]], format="%d/%m/%Y")

This is assuming df is your dataframe, and that you're using the
day/month/year syntax.

To print it into another format, see ?format.Date

Regards

______________________________________________
R-help@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.

Reply via email to