-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
55 lines (41 loc) · 1.8 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
library(naturalstattrick)
```
# naturalstattrick
<!-- badges: start -->
[![R-CMD-check](https://github.com/pbulsink/naturalstattrick/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/pbulsink/naturalstattrick/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/pbulsink/naturalstattrick/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pbulsink/naturalstattrick?branch=master)
<!-- badges: end -->
The goal of naturalstattrick is to provide a convenient and basic interface to game-level Natural Stat Trick data.
## Installation
You can install the development version of naturalstattrick from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("pbulsink/naturalstattrick")
```
## Usage
Get a game's results by calling:
```{r full_report}
nst_report_list(season = 20222023, game_id = 20041)
```
The `game_id` parameter is of the NHL Game ID style and season a 8 digit number (i.e. 20222023 for the 2022-2023 season).
Alternatively rearrange the output to a data.frame type object by calling:
```{r nst_report}
nst_report_df(20222023, 20041)
```
Download a whole season's data (regular season or playoffs) to a .csv file with:
```{r nst_season, eval=F}
get_season_to_file(2022, playoffs = FALSE, file = "~/Desktop/myNSTdata.csv")
```
Note that the abbreviations are all explained on the Natural Stat Trick website at https://www.naturalstattrick.com/glossary.php?teams. If using their data, cite them per their request and maybe sign-up
for their Patreon to support their work.