nhl_games: Retrieve metadata on NHL games from the API

Description Usage Arguments Value Functions Examples

View source: R/nhl_games.R

Description

Retrieve metadata on NHL games from the API

Usage

1
2
3
4
5
6
7
8
9
nhl_games(gameIds, element)

nhl_games_content(gameIds)

nhl_games_feed(gameIds)

nhl_games_boxscore(gameIds)

nhl_games_linescore(gameIds)

Arguments

gameIds

numeric(), vector of one or more game ids. The game id is a 10 digit number where the

  • first 4 digits identify the season of the game, for instance 2017 for the 2017-2018 season.

  • next 2 digits give the type of game, where

    • 01 - preseason,

    • 02 - regular season,

    • 03 - playoffs,

    • 04 - all-star.

  • final 4 digits identify the specific game number

    • for regular season and preseason games, this ranges from 0001 to the number of games played. That is 1271 for seasons with 31 teams and 1230 for seasons with 30 teams.

    • for playoff games, the

      • second digit gives the round of the playoffs

      • third digit specifies the match-up

      • fourth digit specifies the game (out of 7)

element

character() vector of one or more valid elements. Currently the valid elements seem to be:

  • "linescore"

  • "boxscore"

  • "content"

  • "feed/live"

Value

list, with information on games, one element per game and element combination.

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
  # Get content for one game
  nhl_games(2017010001, "content")

  # Get both box score and content for 2 games
  nhl_games(c(2017010001, 2017010002), c("content", "boxscore"))

  # Get content for a game
  nhl_games_content(2017010001)

  # Get the game feed for a game
  nhl_games_feed(2017010001)

  # Get the box score for a game
  nhl_games_boxscore(2017010001)

  # Get the line score for a game
  nhl_games_linescore(2017010001)

## End(Not run)

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