Running into an issue when drawing in Excel data from R and converting to a date within R. I have a "time_period" column that is pulled from Excel in that Excel date format with 5 digit numbers (e.g. 41640).
> head(all$time_period)
[1] "41640" "41671" "41699" "41730" "41760" "41791"
These numbers are originally in chr format so I change them to numeric type with:
all[,3] <- lapply(all[,3], function(x) as.numeric(as.character(x)))
Once that is complete, I run the below to format the date:
all$time_period <-format(as.Date(all$time_period, "1899-12-30"), "%Y-%m-%d")
However, once this action is completed the time_period column is all the same date (presumably the first date in the column).
> head(all$time_period)
[1] "2014-01-01" "2014-01-01" "2014-01-01" "2014-01-01" "2014-01-01" "2014-01-01"
Any suggestions? Thanks in advance.