Skip to contents

Loads player level weekly stats provided by NFL Next Gen Stats starting with the 2016 season. Three different stat types are available and the current season's data updates every night. NGS will only provide data for players above a minimum number of pass/rush/rec attempts.

Usage

load_nextgen_stats(
  seasons = TRUE,
  stat_type = c("passing", "receiving", "rushing"),
  file_type = getOption("nflreadr.prefer", default = "rds")
)

Arguments

seasons

a numeric vector specifying what seasons to return, if TRUE returns all available data

stat_type

one of "passing", "receiving", or "rushing"

file_type

One of "rds" or "qs". Can also be set globally with options(nflreadr.prefer)

Value

A tibble of week-level player statistics provided by NFL Next Gen Stats. Regular season summary is given for week == 0.

See also

https://nextgenstats.nfl.com/stats/passing for stat_type = "passing"

https://nextgenstats.nfl.com/stats/receiving for stat_type = "receiving"

https://nextgenstats.nfl.com/stats/rushing for stat_type = "rushing"

https://nflreadr.nflverse.com/articles/dictionary_nextgen_stats.html for a web version of the data dictionary

dictionary_nextgen_stats for the data dictionary as bundled within the package

Issues with this data should be filed here: https://github.com/nflverse/nflverse-data

Examples

# \donttest{
try({ # prevents cran errors
  load_nextgen_stats(stat_type = "passing")
  load_nextgen_stats(stat_type = "receiving")
  load_nextgen_stats(stat_type = "rushing")
})
#> ── nflverse NFL Next Gen Stats rushing weekly data ─────────────────────────────
#>  Data updated: 2022-03-05 17:06:03 UTC
#> # A tibble: 3,569 × 22
#>    season season_type  week player_display_name player_position team_abbr
#>     <int> <chr>       <int> <chr>               <chr>           <chr>    
#>  1   2016 REG             0 David Johnson       RB              ARI      
#>  2   2016 REG             0 Latavius Murray     RB              LV       
#>  3   2016 REG             0 Paul Perkins        RB              NYG      
#>  4   2016 REG             0 Jonathan Stewart    RB              CAR      
#>  5   2016 REG             0 LeSean McCoy        RB              BUF      
#>  6   2016 REG             0 Tim Hightower       RB              NO       
#>  7   2016 REG             0 C.J. Anderson       RB              DEN      
#>  8   2016 REG             0 Matt Asiata         RB              MIN      
#>  9   2016 REG             0 Doug Martin         RB              TB       
#> 10   2016 REG             0 Jay Ajayi           RB              MIA      
#> # … with 3,559 more rows, and 16 more variables: efficiency <dbl>,
#> #   percent_attempts_gte_eight_defenders <dbl>, avg_time_to_los <dbl>,
#> #   rush_attempts <int>, rush_yards <int>, expected_rush_yards <dbl>,
#> #   rush_yards_over_expected <dbl>, avg_rush_yards <dbl>,
#> #   rush_yards_over_expected_per_att <dbl>, rush_pct_over_expected <dbl>,
#> #   rush_touchdowns <int>, player_gsis_id <chr>, player_first_name <chr>,
#> #   player_last_name <chr>, player_jersey_number <int>, …
# }