Hello, I'm troubleshooting another person's code, where I am the noob. There is an error thrown saying that I did not specify an origin - I thought the origin was automatically 1970-01-01 00:00:00 and that I do not need to specify. Curious too is that code used to work 2 weeks ago, but now does not. How do I correct this error? Below is the partial code (I can post the full script too if that's helpful)
Error in as.POSIXct.numeric(index(dfplot)) : 'origin' must be supplied
dfplot <- merge(as.xts(InputDataTimeSeries), as.xts(pred$lower))
dfplot <- merge(dfplot, as.xts(pred$mean))
dfplot <- merge(dfplot, as.xts(pred$upper))
dfplot <- merge(dfplot, as.xts(pred$fitted))
names(dfplot)[1:7] <- c("actuals", "lower80", "lower95", "predicted", "upper80", "upper95", "fitted")
ggplot(dfplot, aes(x=as.POSIXct(index(dfplot)))) +
geom_line(aes(y=fitted), col='grey90', size = 2) +
geom_line(aes(y=predicted), col='orange', size= 1) +
geom_line(aes(y=actuals), col='orange', size= 1) +
geom_ribbon(aes(ymin=lower80,ymax=upper80),alpha=0.3, fill="orange") +
geom_ribbon(aes(ymin=lower95,ymax=upper95),alpha=0.1, fill="orange") +
theme_bw() +
geom_vline(xintercept=as.numeric(as.POSIXct(end(InputDataTimeSeries))), linetype="dashed", fill="gray40") +
labs(title=paste(pred$method, "80/95% PI Bands" ) , x="Time", y="Observed / Fitted") +
theme(plot.title = element_text(size=18, face="bold"))