Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205372

Sequence date and data frame

$
0
0

I am foresting with ets function from the forecast package.I have daily data from sales for each days in the period from 2015-01-01 until 2015-12-01.Output from this coding is forecast object.This forecast object don't have properly date so I must put forecast into table.

library(forecast)
library(lubridate)

forecast_horizont<-10

DATA_TEST<-data.frame(date_of_sale = seq.Date(as.Date("2015-01-01"), as.Date("2015-12-01"), by = "day"),
                      value=sample(1:50, 335, replace=TRUE))

For the purpose of forecasting, next step should be how to make table like table below.

enter image description here

In below code line I must put forecast_horizont and for that reason I try with this line of code.But there is problem and this line does not work.

EXPAND_DATA_set<-data.frame(date_of_sale = seq.Date(as.Date("2015-12-01"), by = "day")+forecast_horizont)

So can anybody help me how to fix this line of code and make table like table on above pic with using forecast_horizont ?


Viewing all articles
Browse latest Browse all 205372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>