2  Required Packages

As stated earlier we will be using a combination of tidyverse and time series specific packages (tidyverts)

Essential packages required for this journey
Package Purpose
tidyverse Core suite for data wrangling and visualisation (dplyr, tibble, ggplot2, readr, etc)
tsibble Tidy data frames for time series, handles dates, keys and indexing
fable Forecasting models (ETS, ARIMA, Naive, etc) with tidy outputs
feasts Feature Extraction and Analysis for Series Time Series (plots, decomposition, autocorrelation, etc)
lubridate Easy and readable date time manipulation
readr Fast and easy data imports (csv, text data, etc)
readxl Importing excel files (could be optional but very useful)

There is another supporting package in the tidyverts ecosystem called fabletools. This is a supporting package that provides some underlying tools for the fables package.

Note

the readr and lubridate packages are already part of the tidyverse package collections. Once you install tidyverse, you do not need to install them again separately. fabletools is installed together with the fables package.

2.1 Installing the Packages

To install the above packages, run the following code once in your R console:

install.packages(c("tidyverse", "tsibble", "fable", "feasts", "readxl"))
Tip

If you already have them installed, you do not need to reinstall. You can check if a package is installed by typing, for instance "fable" %in% installed.packages() to check if the fable package is already installed.

2.1.1 Loading the Packages

After installing any package you have to load it before it becomes available for use. Each time you start a new R session, you will need to load the packages you will use again. Doing it correctly saves headaches. You can load a package in R with the library() function.

# Load all packages
library(tidyverse)          # Core data wrangling + visualisation
library(tsibble)            # Tidy time series structure
library(fable)              # Forecasting
library(feasts)             # Time series exploration tools
library(readxl)             # Importing Excel files

Think of the install command as buying a tool and placing it in your garage (your computer’s library). The library() function is like grabbing the tool from your garage and bringing it to your workbench (your current R session) so you can use it.

Tip

If you see a message like “there is no package called…”, it means you have not installed it yet. Go back to the installation step.