game_play_by_play: Parsed Descriptive Play-by-Play Dataset for a Single Game

Description Usage Arguments Details Value Examples

View source: R/PlayByPlayBoxScore.R

Description

This function intakes the JSON play-by-play data of a single game and parses the play description column into individual variables allowing the user to segment the game in a variety of different ways for model building and analysis. WARNING: This function is deprecated and will be removed from the package after the 2018-19 season.

Usage

1

Arguments

GameID

(character or numeric) A 10 digit game ID associated with a given NFL game.

Details

Through list manipulation using the do.call and rbind functions a 13 column dataframe with basic information populates directly from the NFL JSON API. These columns include the following:

Through string manipulation and parsing of the description column using base R and stringR, columns were added to the original dataframe allowing the user to have a detailed breakdown of the events of each play. Also provided are calculations for the expected points and win probability for each play using models built entirely on nflscrapR data. The added variables are specified below:

Value

A dataframe with 99 columns specifying various statistics and outcomes associated with each play of the specified NFL game.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Parsed play-by-play of the final game in the 2015 NFL season 

# Save the gameID into a variable 
nfl2015.finalregseasongame.gameID <- "2016010310"

# Input the variable into the function to output the desired dataframe
finalgame2015.pbp <- game_play_by_play(nfl2015.finalregseasongame.gameID) 

# Subset the dataframe based on passing plays
subset(finalgame2015.pbp, PlayType == "Pass")

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