-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME.Rmd
109 lines (79 loc) · 2.78 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
output: github_document
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
message = FALSE,
warning = FALSE,
echo = TRUE,
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/",
out.width = "100%"
)
options(width = 100)
```
# iNZightTS: Time Series Visualisation and Forecasting
[![R-CMD-check](https://github.com/iNZightVIT/iNZightTS/workflows/R-CMD-check/badge.svg)](https://github.com/iNZightVIT/iNZightTS/actions?workflow=R-CMD-check)
[![Codecov test
coverage](https://codecov.io/gh/iNZightVIT/iNZightTS/branch/dev/graph/badge.svg)](https://codecov.io/gh/iNZightVIT/iNZightTS?branch=dev)
[![License: GPL
v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
[![CRAN](https://www.r-pkg.org/badges/version/iNZightTS)](https://CRAN.R-project.org/package=iNZightTS)
[![CRAN](https://www.r-pkg.org/badges/version/iNZightTS)](https://CRAN.R-project.org/package=iNZightTS)
## Overview
The iNZightTS package provides some simple analysis tools for exploring time series data, which is used by [iNZight](https://github.com/iNZightVIT/iNZight). The package uses [tidyverts](https://tidyverts.org/) to store and process time series data and [ggplot2](https://github.com/tidyverse/ggplot2) to produce customisable graphics.
## Installation
The _stable_ version can be installed from [CRAN](https://cran.r-project.org/web/packages/iNZightTS/index.html):
```{r cran, eval = FALSE}
install.packages("iNZightTS")
```
Install from [GitHub](https://github.com/iNZightVIT/iNZightTS):
```{r github, eval = FALSE}
remotes::install_github("iNZightVIT/iNZightTS")
```
## Usage
```{r pkgs}
library(iNZightTS)
```
### Getting started
Use the `inzightts` function to create a temporal data set to be used by the functions of the package. The data is stored as a [tsibble](https://github.com/tidyverts/tsibble).
```{r data}
data <- visitorsQ |>
tidyr::pivot_longer(!Date, names_to = "Country", values_to = "Visitors") |>
inzightts(key = "Country")
data
```
### Graphics
Exploratory analysis of time series data starts from a smoothed line plot.
```{r raw-plot}
plot(data)
```
### Decompositions
Time series data often exhibit features such as trend, season and cycle. A decomposition plot breaks the data into visual components which simplies the analysis.
```{r decomp}
dcmp <- data |>
dplyr::filter(Country == "Australia") |>
inzightts() |>
decomp()
dcmp
```
```{r decomp-plot}
plot(dcmp, title = "Visitors to Australia")
```
### Visualising seasonal effects
Plots are helpful in revealing the underlying seasonal pattern of time series data.
```{r season-plot}
seasonplot(data)
```
```{r subseries-plot}
subseries(data)
```
### Forecasting
```{r forecast}
pred <- predict(data)
summary(pred)
```
```{r forecast-plot}
plot(pred)
```