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

whockeyR

Lifecycle: experimental R-CMD-check

Play-by-play scraper for the PHF (formerly known as the NWHL)


Installation

You can install the released version of whockeyR from GitHub with:

# You can install using the pacman package using the following code:
if (!requireNamespace('pacman', quietly = TRUE)){
  install.packages('pacman')
}
pacman::p_load_current_gh("BenHowell71/whockeyR", dependencies = TRUE, update = TRUE)

If you would prefer the devtools installation:

# if you would prefer devtools installation
if (!requireNamespace('devtools', quietly = TRUE)){
  install.packages('devtools')
}
# Alternatively, using the devtools package:
devtools::install_github(repo = "BenHowell71/whockeyR")

phf_schedule.R

Contains the code scraping the schedule and pertinent league information for each season

pbp_functions.R

Contains the code for all the below functions

data-raw/pbp_data.R

Test files that shows how the functions work for pulling play-by-play data for a regulation game, an overtime game, and an overtime + shootout game.


load_raw_data()

Loads in all the raw data for the game_id in a list format. Takes game_id as an input.


process_period()

Formats the raw data for a period into a workable format. Takes the raw data for a period as an input.


process_shootout()

Formats the raw data of a shootout into a workable format. Takes the raw data of the shootout as an input


pbp_data()

Takes the raw data from load_raw_data as an input then uses process_period and process_shootout to pull out all the by period data and then put it all into one pbp dataframe with


load_pbp()

Pairs load_raw_data and pbp_data to pull the raw data and cleaning/set-up in one function that takes game_id as an input

Follow SportsDataverse on Twitter and star this repo

Twitter Follow

GitHub stars

Our Authors

Our Contributors (they're awesome)

Citations

To cite the whockeyR R package in publications, use:

BibTex Citation

@misc{howell_whockeyR_2021,
  author = {Ben Howell},
  title = {whockeyR: The SportsDataverse's R Package for Women's Hockey Data.},
  url = {https://benhowell71.github.io/whockeyR/},
  year = {2021}
}


benhowell71/fastRhockey documentation built on March 1, 2024, 9:23 a.m.