HI All, I am reading a data file which has different date formats. I wanted to standardize to one format and used a library anytime but got undesired results as shown below. It gave me year 2093 instead of 1993
library(anytime) DFX<-read.table(text="name ddate A 19-10-02 D 11/19/2006 F 9/9/2011 G1 12/29/2010 AA 10/18/93 ",header=TRUE) getFormats() addFormats(c("%d-%m-%y")) addFormats(c("%m-%d-%y")) addFormats(c("%Y/%d/%m")) addFormats(c("%m/%d/%y")) DFX$anew=anydate(DFX$ddate) Output name ddate anew 1 A 19-10-02 2002-10-19 2 D 11/19/2006 2020-11-19 3 F 9/9/2011 2011-09-09 4 G1 12/29/2010 2020-12-29 5 AA 10/18/93 2093-10-18 The problem is in the last row. It should be 1993-10-18 instead of 2093-10-18 How do I correct this? Thank you. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.