nhl_url_players_seasons: Create an NHL API URL for players' seasons statistics

Description Usage Arguments Details Examples

View source: R/nhl_players_seasons.R

Description

Create an NHL API URL for players' seasons statistics

Usage

1
nhl_url_players_seasons(playerIds, seasons, playoffs = FALSE)

Arguments

playerIds

integer(), vector of one or more ids of the players. The ids correspond to the ids expected by the NHL API people endpoint. For most cases the playerNames argument can be provided for more convenient usage.

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.

playoffs

logical(1), if FALSE (default) get the regular seasons data, if TRUE, get the data for the playoffs.

Details

If multiple players and seasons are provided, URLs will be created for all combinations of players and seasons.

Examples

1
2
3
4
5
6
7
8
9
  # Joe Sakic, regular season 1995/1996
  nhlapi:::nhl_url_players_seasons(8451101L, 1995)

  # Joe Sakic, playoffs 1995/1996, 1996/1997 and 1997/1998
  nhlapi:::nhl_url_players_seasons(
    8451101L,
    1995:1997,
    playoffs = TRUE
   )

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