Skip to contents

Loads participation data from the nflverse-data repository

Usage

load_participation(
  seasons = most_recent_season(),
  include_pbp = FALSE,
  file_type = getOption("nflreadr.prefer", default = "rds")
)

Arguments

seasons

A numeric vector of 4-digit years associated with given NFL seasons - defaults to latest season. If set to TRUE, returns all available data since 2016.

include_pbp

a logical: download and join pbp to this data?

file_type

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

Value

A dataframe of participation data, optionally merged with play by play

Examples

# \donttest{
try({ # prevents cran errors
  load_participation(seasons = 2020, include_pbp = TRUE)
})
#> ── nflverse play-by-play participation ─────────────────────────────────────────
#>  Data updated: 2022-08-03 00:16:03 UTC
#> # A tibble: 48,514 × 382
#>    old_game_id play_id possess…¹ offen…² offen…³ defen…⁴ defen…⁵ numbe…⁶ offen…⁷
#>    <chr>         <int> <chr>     <chr>   <chr>     <int> <chr>     <int> <chr>  
#>  1 2020091000        1 ""        NA      NA           NA NA           NA ""     
#>  2 2020091000       39 "KC"      NA      NA           NA NA           NA "00-00…
#>  3 2020091000       54 "HOU"     SHOTGUN 1 RB, …       6 4 DL, …      NA "00-00…
#>  4 2020091000       75 "HOU"     SHOTGUN 1 RB, …       7 4 DL, …       5 "00-00…
#>  5 2020091000       97 "HOU"     NA      1 RB, …      NA 4 DL, …      NA "00-00…
#>  6 2020091000      120 "HOU"     SHOTGUN 2 RB, …       6 4 DL, …       4 "00-00…
#>  7 2020091000      142 "HOU"     NA      NA           NA NA           NA "00-00…
#>  8 2020091000      160 "KC"      SHOTGUN 1 RB, …       6 3 DL, …      NA "00-00…
#>  9 2020091000      181 "KC"      SINGLE… 1 RB, …       7 3 DL, …      NA "00-00…
#> 10 2020091000      202 "KC"      SHOTGUN 1 RB, …       5 2 DL, …       4 "00-00…
#> # … with 48,504 more rows, 373 more variables: n_offense <int>,
#> #   defense_players <chr>, n_defense <int>, game_id <chr>, home_team <chr>,
#> #   away_team <chr>, season_type <chr>, week <int>, posteam <chr>,
#> #   posteam_type <chr>, defteam <chr>, side_of_field <chr>, yardline_100 <dbl>,
#> #   game_date <chr>, quarter_seconds_remaining <dbl>,
#> #   half_seconds_remaining <dbl>, game_seconds_remaining <dbl>,
#> #   game_half <chr>, quarter_end <dbl>, drive <dbl>, sp <dbl>, qtr <dbl>, …
#> # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
# }