Skip to contents

Loads player level season stats provided by Pro Football Reference starting with the 2018 season, primarily to augment existing nflverse data.

Usage

load_pfr_advstats(
  seasons = most_recent_season(),
  stat_type = c("pass", "rush", "rec", "def"),
  summary_level = c("week", "season"),
  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 "pass", "rush", "rec", "def"

summary_level

one of "week" (default) or "season" - some data is only available at the season level

file_type

One of c("rds", "qs", "csv", "parquet"). Can also be set globally with options(nflreadr.prefer)

Value

A tibble of player statistics provided by Pro Football Reference that supplements data in nflverse

Examples

# \donttest{
try({ # prevents cran errors
  load_pfr_advstats()
})
#> ── nflverse advanced pass weekly stats via PFR ─────────────────────────────────
#>  Data updated: 2022-09-28 07:33:42 UTC
#> # A tibble: 796 × 24
#>    game_id    pfr_g…¹ season  week game_…² team  oppon…³ pfr_p…⁴ pfr_p…⁵ passi…⁶
#>    <chr>      <chr>    <int> <int> <chr>   <chr> <chr>   <chr>   <chr>     <dbl>
#>  1 2022_01_B… 202209…   2022     1 REG     LA    BUF     Matthe… StafMa…       2
#>  2 2022_01_B… 202209…   2022     1 REG     LA    BUF     Matthe… StafMa…       2
#>  3 2022_01_B… 202209…   2022     1 REG     LA    BUF     Matthe… StafMa…       2
#>  4 2022_01_B… 202209…   2022     1 REG     LA    BUF     Matthe… StafMa…       2
#>  5 2022_01_B… 202209…   2022     1 REG     LA    BUF     Matthe… StafMa…       2
#>  6 2022_01_B… 202209…   2022     1 REG     LA    BUF     Matthe… StafMa…       2
#>  7 2022_01_B… 202209…   2022     1 REG     LA    BUF     Matthe… StafMa…       2
#>  8 2022_01_B… 202209…   2022     1 REG     LA    BUF     Matthe… StafMa…       2
#>  9 2022_01_B… 202209…   2022     1 REG     LA    BUF     Matthe… StafMa…       2
#> 10 2022_01_B… 202209…   2022     1 REG     LA    BUF     Matthe… StafMa…       2
#> # … with 786 more rows, 14 more variables: passing_drop_pct <dbl>,
#> #   receiving_drop <dbl>, receiving_drop_pct <dbl>, passing_bad_throws <dbl>,
#> #   passing_bad_throw_pct <dbl>, times_sacked <dbl>, times_blitzed <dbl>,
#> #   times_hurried <dbl>, times_hit <dbl>, times_pressured <dbl>,
#> #   times_pressured_pct <dbl>, def_times_blitzed <dbl>,
#> #   def_times_hurried <dbl>, def_times_hitqb <dbl>, and abbreviated variable
#> #   names ¹​pfr_game_id, ²​game_type, ³​opponent, ⁴​pfr_player_name, …
# }