I need to predict the number of flights for 2019 per day. I already have a model to but I need to apply it for the 2019 data. So I may need to add a column contains the date for 2019 to the original data set.
I tried to create_series()
, but it can't be mutated to the original data set.
Error in mutate_impl(.data, dots) : Column "date_2019" is of unsupported class data.frame
f2019 <- create_series(~'2019', 'daily')
flight2019 <- daily %>%
mutate(date(f2019))
I also tried data$
,
daily$date2019 <- create_series(~'2019', 'daily')
but the value is not normal.
date2019
<S3: tbl_time>
<S3: tbl_time>
<S3: tbl_time>
<S3: tbl_time>
<S3: tbl_time>
<S3: tbl_time>
<S3: tbl_time>
I think the problem is in create_series()
, maybe I should use other function to create date variable. I except the daily has a column contains each date in 2019.
i.e,
2019-01-01
2019-01-02
...
or replace the date of daily with 2019's date. (Original date is 2013 in daily)
the data set is following:
# A tibble: 365 x 13
date n wday term residual_wday1 wday2 wday3
<date> <int> <ord> <fct> <dbl> <chr> <chr>
1 2013-01-01 842 Tue wint~ -56.3 Tue Tue
2 2013-01-02 943 Wed wint~ 25.7 Wed Wed
3 2013-01-03 914 Thu wint~ -23.7 Thu Thu
4 2013-01-04 915 Fri wint~ -17.2 Fri Fri
5 2013-01-05 720 Sat wint~ 18.6 Sat-~ Sat-~
6 2013-01-06 832 Sun wint~ 2 Sun Sun
7 2013-01-07 933 Mon wint~ -0.25 Mon Mon
8 2013-01-08 899 Tue wint~ 0.667 Tue Tue
9 2013-01-09 902 Wed wint~ -15.3 Wed Wed
10 2013-01-10 932 Thu wint~ -5.67 Thu Thu
# ... with 355 more rows, and 6 more variables: