tidy_schedules: Get a tidy dataset of NHL schedules

View source: R/tidy_schedules.R

tidy_schedulesR Documentation

Get a tidy dataset of NHL schedules

Description

The function tidy_schedules() is meant to be a user-friendly way of getting NHL schedules, including the final score and shot counts of completed games.

Usage

tidy_schedules(
  seasons_id,
  expand_periods = FALSE,
  regular = TRUE,
  playoffs = TRUE,
  tz = Sys.timezone(),
  keep_id = FALSE,
  return_datatable = getOption("tidynhl.data.table", TRUE)
)

Arguments

seasons_id

Character vector of the seasons ID for which the schedule will be returned. The required format is 'xxxxyyyy'.

expand_periods

(optional) Logical indicating if data should be expanded at the period level. Default to FALSE.

regular

(optional) Logical indicating if the regular season schedules should be returned. Default to TRUE.

playoffs

(optional) Logical indicating if the playoffs schedules should be returned. Default to TRUE.

tz

(optional) Character specifying the timezone that should be used for datetime. Default to the user system time zone.

keep_id

(optional) Logical indicating if the IDs of different dimensions should be returned. Default to FALSE.

return_datatable

(optional) Logical indicating whether or not a data.table should be returned. Default can be set globally with options("tidynhl.data.table").

Examples

# Allowing large outputs for the pkgdown website
options(width = 1000L)

# Get the schedule of the 2019-2020 regular season and playoffs
tidy_schedules("20192020")

# Get the regular season periods of both the 2018-2019 and 2019-2020 seasons, keeping the IDs
# and indicating game datetime with Los Angeles local time
tidy_schedules(
  seasons_id = c("20182019", "20192020"),
  expand_periods = TRUE,
  playoffs = FALSE,
  tz = "America/Los_Angeles",
  keep_id = TRUE
)


jplecavalier/tidynhl documentation built on July 28, 2024, 3:48 a.m.