I have a data frame with 10 dates which I read into R as integers. Here is the data frame:
19820509
19550503
20080505
19590505
19940517
19690504
20050420
20060503
19840427
19550513
We'll called it df.
I have attempted a few different lines of code here to simply change each value to the date format in R like this: "1982-05-09"
df <- as.Date(df, "%Y%m%d")
doesn't work and neither does
df <- as.POSIXlt(df, format = "%Y/%m/%d")
or
df <- as.POSIXct(df), format = "%Y/%m/%d", origin = "19820509")
I keep getting an error saying "do not know how to convert 'df' to class "date" or either of the POSIX formats.
I thought this would be more simple. Any ideas?
Thank you.