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 c("rds", "qs", "csv", "parquet"). 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 Next Gen Stats weekly rushing data ─────────────────────────────────
#>  Data updated: 2022-11-09 07:20:21 UTC
#> # A tibble: 3,883 × 22
#>    season season…¹  week playe…² playe…³ team_…⁴ effic…⁵ perce…⁶ avg_t…⁷ rush_…⁸
#>     <int> <chr>    <int> <chr>   <chr>   <chr>     <dbl>   <dbl>   <dbl>   <int>
#>  1   2016 REG          0 David … RB      ARI        3.87   25.6     2.69     293
#>  2   2016 REG          0 Latavi… RB      LV         3.91   45.6     2.60     195
#>  3   2016 REG          0 Paul P… RB      NYG        3.68    5.36    2.58     112
#>  4   2016 REG          0 Jonath… RB      CAR        4.38   38.1     2.88     218
#>  5   2016 REG          0 LeSean… RB      BUF        3.96   26.9     2.99     234
#>  6   2016 REG          0 Tim Hi… RB      NO         3.74   27.8     2.58     133
#>  7   2016 REG          0 C.J. A… RB      DEN        4.11   22.7     2.51     110
#>  8   2016 REG          0 Matt A… RB      MIN        4.00   38.8     2.29     121
#>  9   2016 REG          0 Doug M… RB      TB         5.17   33.3     2.81     144
#> 10   2016 REG          0 Jay Aj… RB      MIA        3.91   23.1     2.74     260
#> # … with 3,873 more rows, 12 more variables: 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>, player_short_name <chr>, and abbreviated
#> #   variable names ¹​season_type, ²​player_display_name, ³​player_position, …
# }