time series - R isn't recognizing the date field I have sent as an input to Rstudio in .csv format -
[this sample data.]
what had been trying achieve forecasting in r dates csv input via r studio. when i've tried change data type of data field in input using as.date(my_date_field, "%y-%m-%d"), class(my_date_field) results in date printing values of my_date_field results in "na"s. so, unable forecast on timeline basis @ all. please me out sorting out issue.
the code i've used forecasting is:
library(forecast) library(lubridate) fitdata <- read.csv("~//power bi//fit.csv") fitdataset <- aggregate(fitdata$metric ~ fitdata$ped, data = fitdata, fun= sum) fitdataset$
fitdata$ped<- as.date(fitdataset$
fitdata$ped, format="%y-%d-%m") ts_fitdata <- ts(fitdataset$
fitdata$metric, frequency=12, start=c(fitdataset$
fitdata$ped`1,1)) decom <- stl(ts_fitdata, s.window = "periodic") pred <- forecast(decom, h = 7) plot(pred)
`
Comments
Post a Comment