Skip to contents

Obtain RB stats from NFL play-by-play data for a specified time frame from either a saved database or nflreadr::load_pbp().

Usage

get_rb_pbp_stats(
  pbp_db = NULL,
  pbp_db_tbl = NULL,
  seasons = NULL,
  week_min = NULL,
  week_max = NULL
)

Format

A data frame with 59 variables that are described below.

player_id

Player gsis id (e.g., 00-0038120)

player_display_name

Player name (e.g., Breece Hall)

player_name

Player shortened name (e.g., B.Hall)

position

Player position (e.g., RB)

team

Player team (e.g., NYJ)

games

Number of games played

fpts_std_4pt_td

Fantasy points for standard format with 4 point TD

ppg_std_4pt_td

Fantasy points per game for standard format with 4 point TD

fpts_half_ppr_4pt_td

Fantasy points for half PPR format with 4 point TD

ppg_half_ppr_4pt_td

Fantasy points per game for half PPR format with 4 point TD

fpts_ppr_4pt_td

Fantasy points for full PPR format with 4 point TD

ppg_ppr_4pt_td

Fantasy points per game for full PPR format with 4 point TD

fpts_std_6pt_td

Fantasy points for standard format with 6 point TD

ppg_std_6pt_td

Fantasy points per game for standard format with 6 point TD

fpts_half_ppr_6pt_td

Fantasy points for half PPR format with 6 point TD

ppg_half_ppr_6pt_td

Fantasy points per game for half PPR format with 6 point TD

fpts_ppr_6pt_td

Fantasy points for full PPR format with 6 point TD

ppg_ppr_6pt_td

Fantasy points per game for full PPR format with 6 point TD

carries

Number of rush attempts including scrambles and kneel downs. Rushes after a lateral reception don't count as a carry

rushing_yards

Yards gained when rushing including scrambles and kneel downs. Also includes yards gained after obtaining a lateral on a play that started with a rushing attempt

rushing_tds

The number of rushing touchdowns (incl. scrambles). Also includes touchdowns after obtaining a lateral on a play that started with a rushing attempt

rushing_fumbles

Number of rushes with a fumble

rushing_fumbles_lost

Number of rushes with a lost fumble

rushing_first_downs

Number of rushing first downs

rushing_epa

Expected points added (EPA) on rush attempts including scrambles and kneel downs

rushing_2pt_conversions

Two-point conversion rushes

targets

Number of pass plays where the player was targeted as a receiver

receptions

Number of pass receptions. Lateral receptions don't count as a reception

receiving_yards

Yards gained after a pass reception. Includes yards gained after receiving a lateral on a play that started as a pass play

receiving_tds

Number of reception touchdowns, including after receiving a lateral on a play that began as a pass play

receiving_fumbles

Number of fumbles after a pass reception

receiving_fumbles_lost

Number of fumbles lost after a pass reception

receiving_air_yards

Receiving air yards including incomplete passes

receiving_yards_after_catch

Yards after the catch gained on plays in which player was receiver (this is an unofficial stat and may differ slightly between different sources)

receiving_first_downs

Number of first downs gained on a reception

receiving_epa

Expected points added on receptions

receiving_2pt_conversions

Two-point conversion receptions

racr

Receiving Air Conversion Ratio. RACR = receiving_yards / receiving_air_yards

target_share

Share of targets of player compared to all team targets

tgt_pct

Share of targets percentage

air_yards_share

Share of receiving_air_yards of the player to all team air_yards

wopr

Weighted Opportunity Rating. WOPR = 1.5 x target_share + 0.7 x air_yards_share

completions

Total pass completions (CMP)

attempts

Total pass attempts (ATT)

cmp_pct

Pass completion percentage

passing_yards

Total passing yards

passing_tds

Total passing touchdowns

interceptions

Total pass interceptions (INT)

sacks

Total number of sacks taken

sack_yards

Total yards taken from sacks

sack_fumbles

Total fumbles from sacks

sack_fumbles_lost

Total fumbles lost from sacks

passing_air_yards

Passing air yards (includes incomplete passes)

passing_yards_after_catch

Yards after the catch gained on plays in which player was the passer (this is an unofficial stat and may differ slightly between different sources).

passing_first_downs

First downs on pass attempts

passing_epa

Total expected points added (EPA) on pass attempts and sacks. NOTE: This uses the variable qb_epa, which gives QB credit for EPA for up to the point where a receiver lost a fumble after a completed catch and makes EPA work more like passing yards on plays with fumbles

passing_2pt_conversions

Two-point conversion passes

pacr

Passing Air Conversion Ratio. PACR = passing_yards / passing_air_yards

dakota

Adjusted EPA + CPOE composite based on coefficients which best predicts adjusted EPA/play in the following year

Arguments

pbp_db_tbl

Play-by-Play database table name (optional)

seasons

NFL season(s) (required) to obtain play-by-play data. The season can be defined as a single season, season = 2024. For multiple seasons, use either season = c(2023,2024) or season = 2022:2024.

week_min

Minimum week (required) to define whether pulling a range of weeks or the entire season. Use week_min = 1 for the first week of the season, must be an integer.

week_max

Maximum week (optional) to define a range of weeks to pull from an NFL season. If not defined, the data will be pulled for all weeks, beginning with week_min.

pbp_dp

Play-by-Play database path (optional)

Value

Dataframe with RB stats for user-defined season(s) and week(s) obtained from NFL play-by-play data

Details

The function get_rb_pbp_stats can be utilized to obtain player stats for a specified time frame that can include multiple seasons or even a range of weeks instead of the entire season. This includes stats for passing, rushing, and receiving obtained by using the nflfastR function calculate_player_stats(). The player stats are utilized to calculate fantasy points based on common scoring formats (4/6 point TD, STD, Half PPR, Full PPR). The function acquires stats by using cumulative play-by-play data by either loading from a saved database or using nflreadr::load_pbp(). The data is obtained for a user-defined season or multiple seasons. A range of weeks can also be defined with week_min and week_max. If the entire season is desired, use week_min = 1 and week_max does not need to be defined. To specify loading from a database, define the path to the database with pbp_db as well as the name of the table to load with pbp_db_tbl. To load from a database, you will need to save play-by-play data to a database using the nflfastR function, update_db(). For example, the database is saved by default as pbp_db with a table that is stored containing all play-by-play information called nflfastR_pbp. Assume that the database is saved in project_name/data/. Using the default naming scheme, nuclearff::get_pbp_data can be defined using the database with pbp_db = "data/pbp_db" and pbp_db_tbl = "nflfastR_pbp". Note that these two arguments must be defined as strings. For more information on calculated player stats, refer to the nflfastR calculate_player_stats()

See also

nuclearff::get_pbp_data Obtain play-by-play data for a specified time frame from either a saved database or if not defined, using nflreadr::load_pbp()

load_pbp Load play-by-play data

update_db Update or Create a nflfastR Play-by-Play Database

Author

Nolan MacDonald