Need help on r for forecasted line chart, Please find the attachment for details.
As of now, x axis has 2017.0, 2017.5 But I need dynamically plotting for x axis yearmonth like 201701,201702, etc.
Need plotting value i.e population value on chart including the forecasted value.
Below is the code used for chart:
library(forecast) ord <- order(ds$`Year`,ds$`Month`) sds <- ds[ord,] fRec <- sds[1,] mon <- as.numeric(firstRec$'Month') yrs <- as.numeric(as.character(firstRec$'Year')) tm <- ts(data = sds$Population , start= c(yrs,mon) ,frequency = 12) plot(tm) tm[is.na(tm)] <-0 hw <- HoltWinters(tm) plot(forecast(hw,h=3))
Below is sample data: