Learn R Programming

nflscrapR (version 1.4.0)

season_play_by_play: Parsed Descriptive Play-by-Play Function for a Full Season

Description

This function outputs all plays of an entire season in one dataframe. It calls the game_play_by_play function and applies it over every game in the season by extracting each game ID and url in the specified season.

Usage

season_play_by_play(Season)

Arguments

Season

(numeric) A 4-digit year corresponding to an NFL season of interest

Value

A dataframe contains all the play-by-play information for a single season. This includes all the 99 variables collected in our game_play_by_play function (see documentation for game_play_by_play for details) and a column for the Season.

Details

This function calls the extracting_gameids, proper_jsonurl_formatting, and game_play_by_play to aggregate all the plays from a given season. This dataframe is prime for use with the dplyr and plyr packages.

Examples

Run this code
# NOT RUN {
# Play-by-play data from all games in 2010
pbp.data.2010 <- season_play_by_play(2010)

# Looking at all Pittsburgh Steelers offensive plays 
subset(pbp.data.2010, posteam = "PIT")
# }

Run the code above in your browser using DataLab