I am attempting to implement a forecast based on a time series object. However, when I'm getting graphs out of the code the x-axis is as.numeric version of the date:
Here's a snapshot of the subset of data used:
Code used:
ts<-ts(temp$total_cases, frequency = 1, start = min(as.Date(temp$date,"%Y-%m-%d")), end = max(as.Date(temp$date,"%Y-%m-%d")))
# time series labeled object for country's dates and
assign(paste0('ts_',country),ts)
fit <- ets(ts_Afghanistan)
plot(forecast(fit))
When I enter the following the transition to date of the type of output on the x axis is clear:
> as.Date(18300)
[1] "2020-02-08"
Just not sure how to get this reflected in the x-axis label. I tried playing with zoo and other functions without success. Would appreciate help on this.