Skip to contents

Obtain QB stats from NFL cumulative season stats for a specified time frame from either a saved database or nflreadr::load_pbp(). The stats are obtained using play-by-play data, NFL Next Gen Stats (NGS) and Pro Football Reference (PFR).

Usage

get_qb_combined_stats_season(pbp_db = NULL, pbp_db_tbl = NULL, seasons = NULL)

Format

A data frame with 79 variables that are described below.

player_id

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

player_display_name

Player name (e.g., Lamar Jackson)

player_name

Player shortened name (e.g., L.Jackson)

pos

Player position (e.g., QB)

tm

Player team (e.g., BAL)

g

Number of games played

completions

Total pass completions (CMP)from PBP data

attempts

Total pass attempts (ATT)from PBP data

cmp_pct

Pass completion percentage from PBP data

expected_completion_percentage

Expected completion percentage from NGS

completion_percentage_above_expectation

Average expected completion percentage (xCOMP) from NGS

passing_yards

Total passing yards from PBP data

passing_tds

Total passing touchdowns from PBP data

interceptions

Total pass interceptions (INT) from PBP data

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

passer_rating

Average passer rating from NGS

pacr

Passing Air Conversion Ratio. PACR = passing_yards / passing_air_yards from PBP data

dakota

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

aggressiveness

Average aggressiveness (AGG%) from NGS

passing_air_yards

Passing air yards (includes incomplete passes) from PBP data

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) from PBP data

avg_air_distance

Average air distance from NGS

max_air_distance

Maximum or longest air distance from NGS

avg_time_to_throw

Average time to throw (TT) from NGS

avg_completed_air_yards

Average completed air yards (CAY) from NGS

avg_intended_air_yards

Average intended air yards (IAY) from NGS

avg_air_yards_differential

Average air yards differential (AYD) from NGS

max_completed_air_distance

Maximum or longest completed air distance (LCAD) from NGS

avg_air_yards_to_sticks

Average air yards to the sticks (AYTS) from NGS

passing_first_downs

First downs on pass attempts from PBP data

throwaways

Number of throwaways from PFR

spikes

Number of spikes from PFR

drops

Number of throws dropped from PFR

drop_pct

Percentage of dropped throws from PFR

bad_throws

Number of bad throws from PFR

bad_throw_pct

Percentage of bad throws from PFR

pocket_time

Average time in pocket from PFR

times_blitzed

Number of times blitzed from PFR

times_hurried

Number of times hurried from PFR

times_hit

Number of times hit from PFR

times_pressured

Number of times pressured from PFR

pressure_pct

Percent of time pressured from PFR

batted_balls

Number of batted balls from PFR

on_tgt_throws

Number of throws on target from PFR

on_tgt_pct

Percent of throws on target from PFR

rpo_plays

Run-pass-option (RPO) number of plays from PFR

rpo_yards

Run-pass-option (RPO) total yards from PFR

rpo_pass_att

Run-pass-option (RPO) pass attempts from PFR

rpo_pass_yards

Run-pass-option (RPO) pass yards from PFR

rpo_rush_att

Run-pass-option (RPO) rush attempts from PFR

rpo_rush_yards

Run-pass-option (RPO) rush yards from PFR

pa_pass_att

Play action pass attempts from PFR

pa_pass_yards

Play action pass yards from PFR

passing_2pt_conversions

Two-point conversion passes from PBP data

sacks

Total number of sacks taken from PBP data

sack_yards

Total yards taken from sacks from PBP data

sack_fumbles

Total fumbles from sacks from PBP data

sack_fumbles_lost

Total fumbles lost from sacks from PBP data

carries

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

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 from PBP data

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 from PBP data

rushing_fumbles

Number of rushes with a fumble from PBP data

rushing_fumbles_lost

Number of rushes with a lost fumble from PBP data

rushing_first_downs

Number of rushing first downs from PBP data

rushing_epa

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

rushing_2pt_conversions

Two-point conversion rushes from PBP data

fpts_std_4pt_td

Total fantasy points for standard scoring with 4 point touchdowns

ppg_std_4pt_td

Points per game (PPG) for standard scoring with 4 point touchdowns

fpts_half_ppr_4pt_td

Total fantasy points for half point per reception (Half PPR) scoring with 4 point touchdowns

ppg_half_ppr_4pt_td

Points per game (PPG) for half point per reception (Half PPR) scoring with 4 point touchdowns

fpts_ppr_4pt_td

Total fantasy points for point per reception (full PPR) scoring with 4 point touchdowns

ppg_ppr_4pt_td

Points per game (PPG) for point per reception (Full PPR) scoring with 4 point touchdowns

fpts_std_6pt_td

Total fantasy points for standard scoring with 6 point touchdowns

ppg_std_6pt_td

Points per game (PPG) for standard scoring with 6 point touchdowns

fpts_half_ppr_6pt_td

Total fantasy points for half point per reception (Half PPR) scoring with 6 point touchdowns

ppg_half_ppr_6pt_td

Points per game (PPG) for half point per reception (Half PPR) scoring with 6 point touchdowns

fpts_ppr_6pt_td

Total fantasy points for point per reception (full PPR) scoring with 6 point touchdowns

ppg_ppr_6pt_td

Points per game (PPG) for point per reception (Full PPR) scoring with 6 point touchdowns

pfr_id

Pro Football Reference player ID (e.g., JackLa00)

Arguments

pbp_db_tbl

Play-by-Play database table name (optional)

seasons

NFL season (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.

pbp_dp

Play-by-Play database path (optional)

Value

Dataframe with QB stats for user-defined season(s) obtained from NFL play-by-play data, Next Gen Stats (NGS) and Pro Football Reference (PFR)

Details

The function get_qb_combined_stats_season can be utilized to obtain player stats for a season, including advanced stats. 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. Play-by-play data is merged with NFL Next Gen Stats (NGS) utilizing the nflreadr function load_nextgen_stats to load player level weekly stats starting with the 2016 season. Play-by-play data is also merged with advanced stats from Pro Football Reference (PFR), beginning from 2018. Note that to use this function, seasons must be 2018 or later.

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

load_nextgen_stats Load player level weekly NFL Next Gen Stats

load_pfr_advstats Load advanced stats from PFR

Author

Nolan MacDonald