[R] Problem with DateVisit-gives wrong year?
Pancho Mulongeni
p.mulongeni at namibia.pharmaccess.org
Wed Apr 17 13:18:48 CEST 2013
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
More information about the R-help
mailing list