scrape_game_ids: Scrape game ids for a given NFL season (either pre, regular,...

Description Usage Arguments Value Examples

View source: R/scrape_games_and_urls.R

Description

This function returns all available game ids for a given season, with an option specifying which type of game ids to return (either the pre, regular, or post season) as well as the weeks considered.

Usage

1
scrape_game_ids(season, type = "reg", weeks = NULL, teams = NULL)

Arguments

season

Numeric 4-digit year associated with an NFL season

type

String indicating the type of game ids to find, must either be "pre", "reg", or "post" (default is "reg").

weeks

Numeric vector indicating which weeks of preseason (0 to 4 except for 2011 season without Hall of Fame game) or regular season games (1 to 17) to grab (default value of NULL corresponds to selecting all available weeks).

teams

String vector indicating which teams (based on the abbreviation) the function should grab game info for (default value of NULL corresponds to selecting all available teams).

Value

Data frame with columns containing the season type, game_id, week number (if pre or regular season), the year of the season, home team, away team, a variable indicating the state of the game (POST is over, PRE is before or during), game's url, and the home and away team scores if the game is over.

Examples

1
2
# Scraping all game ids from 2017 regular season:
scrape_game_ids(2017) 

maksimhorowitz/nflscrapR documentation built on April 3, 2020, 7:40 p.m.