I am trying to complete a time series forecast the number of calls that will come in by month for the next 2 years using the following Dataset
I used the line of business Driver and Vehicle Services queues (English + French)
The data includes 3 columns: The line of business for the call, the date (month & year) and the numbers of calls handled.
For my preliminary analysis, I'm attempting to use the autoplot
function but am running into issues. I've tried the following code.
# Load the forecasting package
library(fpp3)
# Load the Data
load(Book3)
# Declare time series data
Book3 <- ts( Book3, [,3], start = 2016,1, frequency = 12)
############################################
Preliminary analysis
############################################
#Time Plot
autoplot(Book3) +
ggtitle("Test plot") +
ylab("Calls Handled")
"Book3" being the name of my dataset. The issue however is that when I try and run it, I get the following error:
Error in `autoplot()`:
! Objects of type tbl_df/tbl/data.frame not supported by autoplot.
Run `rlang::last_error()` to see where the error occurred.
Dataset can also be reconstructed using the bellow:
structure(list(`Queue Group/Line of Business` = c("Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)",
"Driver and Vehicle Services queues (English + French)", "Driver and Vehicle Services queues (English + French)"
), DATE = c("2016-Jan", "2016-Feb", "2016-Mar", "2016-Apr", "2016-May",
"2016-Jun", "2016-Jul", "2016-Aug", "2016-Sep", "2016-Oct", "2016-Nov",
"2016-Dec", "2017-Jan", "2017-Feb", "2017-Mar", "2017-Apr", "2017-May",
"2017-Jun", "2017-Jul", "2017-Aug", "2017-Sep", "2017-Oct", "2017-Nov",
"2017-Dec", "2018-Jan", "2018-Feb", "2018-Mar", "2018-Apr", "2018-May",
"2018-Jun", "2018-Jul", "2018-Aug", "2018-Sep", "2018-Oct", "2018-Nov",
"2018-Dec", "2019-Jan", "2019-Feb", "2019-Mar", "2019-Apr", "2019-May",
"2019-Jun", "2019-Jul", "2019-Aug", "2019-Sep", "2019-Oct", "2019-Nov",
"2019-Dec", "2020-Jan", "2020-Feb", "2020-Mar", "2020-Apr", "2020-May",
"2020-Jun", "2020-Jul", "2020-Aug", "2020-Sep", "2020-Oct", "2020-Nov",
"2020-Dec", "2021-Jan", "2021-Feb", "2021-Mar", "2021-Apr", "2021-May",
"2021-Jun", "2021-Jul", "2021-Aug", "2021-Sep"), `Calls Handled` = c(70660,
61905, 63322, 68323, 72465, 67761, 64797, 77825, 71506, 71563,
73651, 62384, 78243, 66130, 72600, 57756, 71920, 75819, 73144,
82160, 70994, 73033, 66115, 53979, 71682, 57638, 66280, 56167,
75368, 70826, 73149, 79144, 70100, 72516, 63654, 53070, 73814,
57584, 66132, 63191, 72111, 63801, 68660, 67934, 57454, 56167,
49349, 45312, 60766, 50218, 56790, 62748, 84383, 95169, 79610,
70333, 80930, 75381, 77950, 78096, 73031, 60816, 89674, 74114,
74114, 74717, 64373, 64202, 99922)), class = c("tbl_df", "tbl",
"data.frame"), row.names = c(NA, -69L))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.