Description Usage Arguments Details Value Author(s) Examples
Creates a shell database for NHL games from 2002 to present, unfilled with game information. Uses this to collect and scrape NHL data, but not process them immediately.
1 2 3 4 5 6 7 8 9 | full.game.database(extra.seasons=0)
download.single.game (season="20122013",
gcode="20001",
rdata.folder="nhlr-data",
verbose=TRUE,
wait=20)
download.games (games=full.game.database(),
rdata.folder="nhlr-data",
...)
|
extra.seasons |
Beyond 20142015, adds data for additional seasons (assuming nhlscrapr is not supported and updated before the season begins. |
season |
A character string for the two years specifying an NHL season. |
gcode |
The five-digit ID number for a particular NHL game. |
rdata.folder |
The location within the current directory to which to save the downloaded files. Will be created if it does not exist. |
verbose |
Report additional messages. |
wait |
Amount of time in seconds to wait between game downloads. |
games |
A game database, such as the one produced by full.game.database(). |
... |
Arguments to pass to download.single.game(). |
full.game.database() gives ID numbers for all regular-season and playoff games played between 2002 and 2013, with indicators for whether any particular game is known to be unavailable.
download.single.game() retrieves the relevant files for a single game from NHL.com.
download.games() retrieves the files for all games in the table.
full.game.database: a data frame with columns including season, session (Regular or Playoffs), game number/gcode (which game in the season?). Placeholders for teams, score and date of game are included to be filled in later. “valid” indicates whether a full record of the game is available for download.
download.single.game: returns a single Boolean value indicating if no errors were recorded during the download. Saves the game to disk, particularly the PL, ES, SCH and SCV files, along with JSON data for x-y events.
download.games: returns the input game database with “valid” changed to FALSE for any failed downloads.
A.C. Thomas <act@acthomas.ca>
1 2 3 4 5 6 7 8 9 10 11 12 | #Select a part of the history.
game.table <- full.game.database()[201:220,]
#Download one game.
download.single.game(game.table$season[1], game.table$gcode[1], wait=1)
#Download all games.
## Not run:
game.table.updated <- download.games (games=game.table)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.