I have dates that are before 1969 stored as a character and want to change them to a date column.
This is the code I've tried
options(chron.year.expand =
function (y, cut.off = 19, century = c(1900, 2000), ...) {
chron:::year.expand(y, cut.off = cut.off, century = century, ...)
}
)
test$construction_date2<-as.Date(chron(format(as.Date(test$construction_date, "%d-%b-%y"),"%d/%m/%Y")))
But I get the warning message:
Warning message:
In convert.dates(dates., format = fmt, origin. = origin.) :
224 months out of range set to NA
With the output:
construction_date contruction_date2
23-MAR-59 2059-03-23
05-JUN-95 1995-06-05
30-MAY-87 1987-05-30
15-JAN-18 NA
01-FEB-68 2068-02-01
Can anyone tell me where I'm going wrong?
Reproducible example;
constuction_date<-c("23-MAR-59","05-JUN-95","30-MAY-87","15-JAN-18","01-FEB-68")
Expected outcome:
construction_date contruction_date2
23-MAR-59 1959-03-23
05-JUN-95 1995-06-05
30-MAY-87 1987-05-30
15-JAN-18 2018-01-15
01-FEB-68 1968-02-01
lubridate
solution... that's the package that has given me the most date success also :)dmy
function unfortunately will return2059
and not1959
for the59
value. I deleted my answer.