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

.for_cran()
# \donttest{
try({ # prevents cran errors
  load_participation(seasons = 2020, include_pbp = TRUE)
})
#> ── nflverse play-by-play participation ─────────────────────────────────────────
#>  Data updated: 2023-09-12 22:00:10 UTC
#> # A tibble: 48,513 × 383
#>    nflverse_game_id play_id possession_team offense_formation offense_personnel
#>    <chr>              <int> <chr>           <chr>             <chr>            
#>  1 2020_01_ARI_SF         1 ""              NA                NA               
#>  2 2020_01_ARI_SF        39 "ARI"           NA                NA               
#>  3 2020_01_ARI_SF        54 "SF"            SHOTGUN           2 RB, 1 TE, 2 WR 
#>  4 2020_01_ARI_SF        93 "SF"            SHOTGUN           2 RB, 1 TE, 2 WR 
#>  5 2020_01_ARI_SF       118 "SF"            SINGLEBACK        2 RB, 1 TE, 2 WR 
#>  6 2020_01_ARI_SF       143 "SF"            SHOTGUN           2 RB, 1 TE, 2 WR 
#>  7 2020_01_ARI_SF       165 "SF"            SHOTGUN           1 RB, 1 TE, 3 WR 
#>  8 2020_01_ARI_SF       197 "SF"            NA                NA               
#>  9 2020_01_ARI_SF       226 "SF"            NA                NA               
#> 10 2020_01_ARI_SF       245 "ARI"           SHOTGUN           1 RB, 1 TE, 3 WR 
#> # ℹ 48,503 more rows
#> # ℹ 378 more variables: defenders_in_box <int>, defense_personnel <chr>,
#> #   number_of_pass_rushers <int>, players_on_play <chr>, offense_players <chr>,
#> #   defense_players <chr>, n_offense <int>, n_defense <int>, old_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>, …
# }