Reputation: 75
I have a dataframe with a date column like the following:
19870703
19920929
20051015
20030613
How can I change the numeric Data to a Date format like %Y%m%d? Neither as.date() nor as.POSIX.ct() works?
Upvotes: 0
Views: 1178
Reputation: 1443
Using lubridate
date <- ymd("19870703")
in place of date you can put your column name
Upvotes: 2
Reputation: 138
as.Date("19870703", "%Y%m%d")
[1] "1987-07-03"
Apply for entire column.
Upvotes: 0