Hi I have the following factor of dates that I want to converted to Date class so I can extract the month > test.date [1] 14/05/2012 14/05/2012 14/05/2012 14/05/2012 14/05/2012 14/05/2012 [7] 14/05/2012 14/05/2012 14/05/2012 14/05/2012 201 Levels: 01/10/2012 01/11/2012 01/12/2012 02/07/2012 ... 28/09/2012 I use code below ntest.date<-as.Date(test.date,'%d/%m/%y')
but the output has the wrong year, and the reverse order ntest.date [1] "2020-05-14" "2020-05-14" "2020-05-14" "2020-05-14" "2020-05-14" [6] "2020-05-14" "2020-05-14" "2020-05-14" "2020-05-14" "2020-05-14" What am I doing wrong? I dare not say the word 'bug' Thanks Pancho Mulongeni Research Assistant PharmAccess Foundation 1 Fouché Street Windhoek West Windhoek Namibia Tel: +264 61 419 000 Fax: +264 61 419 001/2 Mob: +264 81 4456 286 ______________________________________________ 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.