forked from TimothyMerlin/tstools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
65 lines (47 loc) · 2.41 KB
/
README.Rmd
File metadata and controls
65 lines (47 loc) · 2.41 KB
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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
# 🚧 Work in progress – not ready for public use.
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# {tstools} -- a Time Series Toolbox for Official Statistics
<!-- badges: start -->
[](https://CRAN.R-project.org/package=tstools)
[](https://github.com/kof-ch/tstools/actions)
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://r-pkg.org/pkg/tstools)
<!-- badges: end -->
Plot official statistics' time series conveniently: automatic legends, highlight windows, stacked bar chars with positive and negative contributions, sum-as-line option, two y-axes with automatic horizontal grids that fit both axes and other popular chart types. 'tstools' comes with a plethora of defaults to let you plot without setting an abundance of parameters first, but gives you the flexibility to tweak the defaults. In addition to charts, 'tstools' provides a super fast, 'data.table' backed time series I/O that allows the user to export / import long format, wide format and transposed wide format data to various file types.
-> [pkgdown documentation](https://kof-ch.github.io/tstools/) <-
## Installation
You can install the development version of tstools from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("kof-ch/tstools")
```
## Example Use: Time Series Charts with Legends by Default
{tstools} lets you draw time series line charts that come with a legend out-of-the-box. Simply
feed the `tsplot()` function with a list of time series.
```{r example, message=FALSE}
library(tstools)
## basic example code
tsl <- list(
AirPassengers = AirPassengers,
JohnsonJohnson = JohnsonJohnson
)
tsplot(tsl)
```
and use easily use 2 y-axis. (I know some argue those double axes are fundamentally flawed, but my peers didn't care and asked for it.)
```{r}
tsplot(
"Air Passengers" = tsl$AirPassengers,
tsr = list("Johnson & Johnson" = tsl$JohnsonJohnson)
)
```