knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

rpuck

R build status codecov

If you were to try and analyze statistics for your favorite hockey team, or try to predict an outcome of the next match you'd probably browse the internet in search of convenient tools to get the data you want from the NHL website. While there are a bunch of NHL API packages available in python, there is limited availability of many R packages. Therefore, the rpuck library is designed to allow users the ability to conveniently get both relevant and historical statistics from the publicly available but as of yet undocumented NHL.com API. As of now the package has limited functionality, and is considered a work-in-progress. We will add in additional functionality in the coming weeks which can easily be extended based on feedback we recieve.

Team

| Jarvis Nederlof | Xugang Zhong | Polina Romanchenko | Manish Joshi|

Installation

You can install the development version of rpuck from GitHub with:

# install.packages("devtools")
devtools::install_github("UBC-MDS/rpuck")

Features

You can also find function descriptions and their use cases in package vignettes

Documentations

Usage Example

The package can extract and visualize data from NHL statistics in convenient format. Below is an example of how one can use rpuck.

To load the package:

library(rpuck)

Get a chart showing the attendance over a specified time period:

attendance(regular=TRUE, playoffs=FALSE, start_season= 1990, end_season=2018)

Result of draft by pick number, draft number and year in summary report:

draft_pick(pick_number = 1, round_number = 2, year = 2019)

Query the top 100 player's stats from the player's summary report:

player_s <- player_stats(start_date = "2019-10-02", end_date = "2020-02-28")
head(player_s)

Stats for teams specified by start year or start year and end year:

attendance <- team_stats(start_season = "19801981", end_season = "19891990")
head(attendance)

Tests

We have included a variety of tests for each function in the tests\testthat directory. The tests check that the functions error gracefully and that proper function calls return the correct data/objects.

R Ecosystem

There are some packages written in the R language that are focused on providing a user with convenient tools to access statistics from NHL.com with API calls and helping to make sense of them. Rpuck is landing in its own niche with compared with such libraries as nhlapi, nhlscrape.

Dependencies

R version 3.6.1 and R packages:

| Package | Minimum Supported Version | |---------------------------------------------------------- |--------------------------- | | dplyr | 0.8.3 | | httr | 1.4.1 | | ggplot2 | 3.2.1 | | jsonlite | 1.6 | | grid | 3.6.2 | | gridExtra | 2.3 | | glue | 1.3.1 | | tidyr | 1.0.0 | | testthat | 2.3.1 | | scales | 1.0.0 |



UBC-MDS/rpuck documentation built on April 2, 2020, 3:59 a.m.