nhl_tournaments: Retrieve data on tournaments from the API

Description Usage Arguments Value Functions Examples

View source: R/nhl_tournaments.R

Description

Retrieve data on tournaments from the API

Usage

1
2
3
4
5
6
7
nhl_tournaments(tournamentTypes, seasons = NULL, expand = NULL)

nhl_tournaments_playoffs(seasons = NULL, expand = NULL)

nhl_tournaments_olympics(seasons = NULL, expand = NULL)

nhl_tournaments_worldcups(seasons = NULL, expand = NULL)

Arguments

tournamentTypes

character(), vector of one or more tournament types. Currently supported types seem to be

  • "playoffs"

  • "olympics"

  • "worldCup"

Those are exposed via shorthand functions

  • nhl_tournaments_playoffs()

  • nhl_tournaments_olympics()

  • nhl_tournaments_worldcups()

seasons

numeric(), integer() or character(), vector of starting years of desired seasons in YYYY format, e.g. 1995 or "1995" for season 1995-1996. Accepts vectors such as c(1995:2000, 2010) to generate multiple seasons.

Alternatively, also accepts character() with seasons in the format "YYYYZZZZ", where ZZZZ = YYYY + 1, e.g. "19951996". This is the format that ultimately gets sent to the NHL API.

Some API endpoints, notably seasons exposed via nhl_seasons() also allow the value "current" to passed. This value will be returned unchanged.

expand

character(), of parameters passed as expand to the API URL. Two valid examples seem to be "round.series" and "schedule.game.seriesSummary". NULL for no expand parameter.

Value

list, with information on tournaments, one element per tournamentTypes and parameters (seasons and expand) combinations.

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
  # Get info on playoffs in one season
  nhl_tournaments("playoffs", 2015)

  # Get info on playoffs in 2 seasons, expand rounds
  nhl_tournaments("playoffs", 2015:2016, "round.series")

## End(Not run)

## Not run: 
  nhl_tournaments_playoffs(2015:2016, "round.series")

## End(Not run)
## Not run: 
  nhl_tournaments_olympics(2009, "round.series")

## End(Not run)
## Not run: 
  nhl_tournaments_worldcups(2003)

## End(Not run)

nhlapi documentation built on Feb. 20, 2021, 9:06 a.m.