diff --git a/articles/beginners_guide.html b/articles/beginners_guide.html index 66d11836..dbeb1d79 100644 --- a/articles/beginners_guide.html +++ b/articles/beginners_guide.html @@ -719,7 +719,7 @@

Figures with QB stats
 load_teams()
 #> ── nflverse team graphics ──────────────────────────────────────────────────────
-#>  Data updated: 2024-03-11 10:54:38 UTC
+#>  Data updated: 2024-03-11 11:08:30 UTC
 #> # A tibble: 32 × 16
 #>    team_abbr team_name      team_id team_nick team_conf team_division team_color
 #>    <chr>     <chr>          <chr>   <chr>     <chr>     <chr>         <chr>     
@@ -969,7 +969,7 @@ 

Get team wins each season#> $ stadium_id : chr [1:6706] "ATL00" "CHI98" "CLE00" "GNB00" ... #> $ stadium : chr [1:6706] "Georgia Dome" "Soldier Field" "Cleveland Browns Stadium" "Lambeau Field" ... #> - attr(*, "nflverse_type")= chr "games and schedules" -#> - attr(*, "nflverse_timestamp")= POSIXct[1:1], format: "2024-03-11 10:55:05"

+#> - attr(*, "nflverse_timestamp")= POSIXct[1:1], format: "2024-03-11 11:08:58"

To start, we want to create a dataframe where each row is a team-season observation, listing how many games they won. There are multiple ways to do this, but I’m going to just take the home and away @@ -982,7 +982,7 @@

Get team wins each season rename(team = home_team) home %>% head(5) #> ── nflverse games and schedules ──────────────────────────────────────────────── -#> Data updated: 2024-03-11 10:55:05 UTC +#> Data updated: 2024-03-11 11:08:58 UTC #> # A tibble: 5 × 4 #> season week team result #> <int> <int> <chr> <int> @@ -1001,7 +1001,7 @@

Get team wins each season mutate(result = -result) away %>% head(5) #> ── nflverse games and schedules ──────────────────────────────────────────────── -#> Data updated: 2024-03-11 10:55:05 UTC +#> Data updated: 2024-03-11 11:08:58 UTC #> # A tibble: 5 × 4 #> season week team result #> <int> <int> <chr> <int> @@ -1026,7 +1026,7 @@

Get team wins each season results %>% filter(season == 2019 & team == 'SEA') #> ── nflverse games and schedules ──────────────────────────────────────────────── -#> Data updated: 2024-03-11 10:55:05 UTC +#> Data updated: 2024-03-11 11:08:58 UTC #> # A tibble: 16 × 5 #> season week team result win #> <int> <int> <chr> <int> <dbl> diff --git a/articles/beginners_guide_files/figure-html/fig2-1.png b/articles/beginners_guide_files/figure-html/fig2-1.png index d169732f..3ce30441 100644 Binary files a/articles/beginners_guide_files/figure-html/fig2-1.png and b/articles/beginners_guide_files/figure-html/fig2-1.png differ diff --git a/articles/beginners_guide_files/figure-html/fig3-1.png b/articles/beginners_guide_files/figure-html/fig3-1.png index 80378f24..430ea904 100644 Binary files a/articles/beginners_guide_files/figure-html/fig3-1.png and b/articles/beginners_guide_files/figure-html/fig3-1.png differ diff --git a/articles/field_descriptions.html b/articles/field_descriptions.html index a8c225b1..c0ad3eb5 100644 --- a/articles/field_descriptions.html +++ b/articles/field_descriptions.html @@ -153,8 +153,8 @@

-
- +
+ diff --git a/articles/nflfastR.html b/articles/nflfastR.html index 0218ea1b..61787d74 100644 --- a/articles/nflfastR.html +++ b/articles/nflfastR.html @@ -176,11 +176,11 @@

The Main Functionsdplyr::pull(game_id) pbp <- nflfastR::build_nflfastR_pbp(ids) #> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.6.1.9007 ── -#> • 10:56:04 | Start download of 3 games... -#> 10:56:10 | Download finished. Adding variables... -#> 10:56:10 | added game variables -#> 10:56:10 | added nflscrapR variables -#> [10:56:10] WARNING: src/learner.cc:553: +#> • 11:10:05 | Start download of 3 games... +#> 11:10:10 | Download finished. Adding variables... +#> 11:10:10 | added game variables +#> 11:10:11 | added nflscrapR variables +#> [11:10:11] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -188,9 +188,9 @@

The Main Functions#> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. -#> 10:56:11 | added ep variables -#> 10:56:11 | added air_yac_ep variables -#> [10:56:11] WARNING: src/learner.cc:553: +#> 11:10:11 | added ep variables +#> 11:10:11 | added air_yac_ep variables +#> [11:10:11] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -199,7 +199,7 @@

The Main Functions#> #> for more details about differences between saving model and serializing. #> -#> [10:56:11] WARNING: src/learner.cc:553: +#> [11:10:11] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -207,9 +207,9 @@

The Main Functions#> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. -#> 10:56:11 | added wp variables -#> 10:56:11 | added air_yac_wp variables -#> [10:56:11] WARNING: src/learner.cc:553: +#> 11:10:12 | added wp variables +#> 11:10:12 | added air_yac_wp variables +#> [11:10:12] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -217,14 +217,14 @@

The Main Functions#> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. -#> 10:56:11 | added cp and cpoe -#> 10:56:11 | added fixed drive variables -#> 10:56:11 | added series variables -#> • 10:56:11 | Cleaning up play-by-play... -#> 10:56:12 | Cleaning completed -#> 10:56:12 | added qb_epa -#> • 10:56:12 | Computing xyac... -#> [10:56:13] WARNING: src/learner.cc:553: +#> 11:10:12 | added cp and cpoe +#> 11:10:12 | added fixed drive variables +#> 11:10:12 | added series variables +#> • 11:10:12 | Cleaning up play-by-play... +#> 11:10:12 | Cleaning completed +#> 11:10:12 | added qb_epa +#> • 11:10:12 | Computing xyac... +#> [11:10:13] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -232,9 +232,9 @@

The Main Functions#> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. -#> 10:56:14 | added xyac variables -#> • 10:56:14 | Computing xpass... -#> [10:56:14] WARNING: src/learner.cc:553: +#> 11:10:15 | added xyac variables +#> • 11:10:15 | Computing xpass... +#> [11:10:15] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -242,9 +242,9 @@

The Main Functions#> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. -#> 10:56:14 | added xpass and pass_oe -#> • 10:56:14 | Decode player ids... -#> 10:56:15 | Decoding of player ids completed +#> 11:10:15 | added xpass and pass_oe +#> • 11:10:15 | Decode player ids... +#> 11:10:16 | Decoding of player ids completed #> ── DONE ────────────────────────────────────────────────────────────────────────

In most cases, however, it is not necessary to use this function for individual games, because nflfastR provides both a data repository and @@ -459,7 +459,7 @@

Exampl tictoc::tic(glue::glue("{length(games_2019)} games with nflfastR:")) f <- nflfastR::fast_scraper(games_2019) tictoc::toc() -#> 10 games with nflfastR:: 7.806 sec elapsed +#> 10 games with nflfastR:: 7.634 sec elapsed

Example 3: Completion Percentage Over Expected (CPOE) @@ -475,7 +475,7 @@

Example 3: Completio tictoc::tic("loading all games from 2009") games_2009 <- nflfastR::load_pbp(2009) %>% dplyr::filter(season_type == "REG") tictoc::toc() -#> loading all games from 2009: 1.888 sec elapsed +#> loading all games from 2009: 2.278 sec elapsed games_2009 %>% dplyr::filter(!is.na(cpoe)) %>% dplyr::group_by(passer_player_name) %>% @@ -965,14 +965,14 @@

Build database
 nflfastR::update_db()
 #> ── Update nflfastR Play-by-Play Database ──────── nflfastR version 4.6.1.9007 ──
-#>  10:56:56 | Can't find the data table "nflfastR_pbp"
+#>  11:11:05 | Can't find the data table "nflfastR_pbp"
 #> in your database. Will load the play by play data from
 #> scratch.
-#> • 10:56:56 | Starting download of 25 seasons between 1999 and 2023...
-#> • 10:58:10 | Checking for missing completed games...
-#>  10:58:12 | You have 6703 games and are missing 0.
-#>  10:58:12 | Database update completed
-#>  10:58:12 | Path to your db: ./pbp_db
+#> • 11:11:05 | Starting download of 25 seasons between 1999 and 2023...
+#> • 11:12:27 | Checking for missing completed games...
+#>  11:12:28 | You have 6703 games and are missing 0.
+#>  11:12:29 | Database update completed
+#>  11:12:29 | Path to your db: ./pbp_db
 #> ── DONE ────────────────────────────────────────────────────────────────────────

This created a database in the current directory called pbp_db.

@@ -984,10 +984,10 @@

Build database
 nflfastR::update_db()
 #> ── Update nflfastR Play-by-Play Database ──────── nflfastR version 4.6.1.9007 ──
-#> • 10:58:12 | Checking for missing completed games...
-#>  10:58:13 | You have 6703 games and are missing 0.
-#>  10:58:13 | Database update completed
-#>  10:58:13 | Path to your db: /home/runner/work/nflfastR/nflfastR/vignettes/pbp_db
+#> • 11:12:29 | Checking for missing completed games...
+#>  11:12:29 | You have 6703 games and are missing 0.
+#>  11:12:30 | Database update completed
+#>  11:12:30 | Path to your db: /home/runner/work/nflfastR/nflfastR/vignettes/pbp_db
 #> ── DONE ────────────────────────────────────────────────────────────────────────

If it’s partway through a season and you want to re-build a season to allow for data corrections from the NFL to propagate into your database, @@ -995,13 +995,13 @@

Build database
 nflfastR::update_db(force_rebuild = 2020)
 #> ── Update nflfastR Play-by-Play Database ──────── nflfastR version 4.6.1.9007 ──
-#> • 10:58:13 | Purging season 2020 from the data table "nflfastR_pbp" in your
+#> • 11:12:30 | Purging season 2020 from the data table "nflfastR_pbp" in your
 #> connected database...
-#> • 10:58:14 | Starting download of the 1 season 2020
-#> • 10:58:17 | Checking for missing completed games...
-#>  10:58:18 | You have 6703 games and are missing 0.
-#>  10:58:18 | Database update completed
-#>  10:58:18 | Path to your db: /home/runner/work/nflfastR/nflfastR/vignettes/pbp_db
+#> • 11:12:31 | Starting download of the 1 season 2020
+#> • 11:12:34 | Checking for missing completed games...
+#>  11:12:35 | You have 6703 games and are missing 0.
+#>  11:12:35 | Database update completed
+#>  11:12:35 | Path to your db: /home/runner/work/nflfastR/nflfastR/vignettes/pbp_db
 #> ── DONE ────────────────────────────────────────────────────────────────────────
diff --git a/pkgdown.yml b/pkgdown.yml index a57d7f0b..3954abc5 100644 --- a/pkgdown.yml +++ b/pkgdown.yml @@ -5,7 +5,7 @@ articles: beginners_guide: beginners_guide.html field_descriptions: field_descriptions.html nflfastR: nflfastR.html -last_built: 2024-03-11T10:52Z +last_built: 2024-03-11T11:06Z urls: reference: https://www.nflfastr.com/reference article: https://www.nflfastr.com/articles diff --git a/reference/build_nflfastR_pbp.html b/reference/build_nflfastR_pbp.html index fca86562..f2845acd 100644 --- a/reference/build_nflfastR_pbp.html +++ b/reference/build_nflfastR_pbp.html @@ -202,12 +202,12 @@

Examplesbuild_nflfastR_pbp(c("2018_21_NE_LA", "2019_21_SF_KC")) }) #> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.6.1.9007 ── -#> • 10:52:57 | Start download of 2 games... +#> • 11:06:42 | Start download of 2 games... #> It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan("multisession")`! Will go on sequentially... -#> 10:52:58 | Download finished. Adding variables... -#> 10:52:59 | added game variables -#> 10:52:59 | added nflscrapR variables -#> [10:52:59] WARNING: src/learner.cc:553: +#> 11:06:44 | Download finished. Adding variables... +#> 11:06:45 | added game variables +#> 11:06:45 | added nflscrapR variables +#> [11:06:45] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -216,9 +216,9 @@

Examples#> #> for more details about differences between saving model and serializing. #> -#> 10:53:00 | added ep variables -#> 10:53:00 | added air_yac_ep variables -#> [10:53:00] WARNING: src/learner.cc:553: +#> 11:06:46 | added ep variables +#> 11:06:46 | added air_yac_ep variables +#> [11:06:46] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -227,7 +227,7 @@

Examples#> #> for more details about differences between saving model and serializing. #> -#> [10:53:00] WARNING: src/learner.cc:553: +#> [11:06:46] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -236,9 +236,9 @@

Examples#> #> for more details about differences between saving model and serializing. #> -#> 10:53:00 | added wp variables -#> 10:53:00 | added air_yac_wp variables -#> [10:53:00] WARNING: src/learner.cc:553: +#> 11:06:46 | added wp variables +#> 11:06:46 | added air_yac_wp variables +#> [11:06:46] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -247,14 +247,14 @@

Examples#> #> for more details about differences between saving model and serializing. #> -#> 10:53:00 | added cp and cpoe -#> 10:53:00 | added fixed drive variables -#> 10:53:00 | added series variables -#> • 10:53:00 | Cleaning up play-by-play... -#> 10:53:00 | Cleaning completed -#> 10:53:01 | added qb_epa -#> • 10:53:01 | Computing xyac... -#> [10:53:02] WARNING: src/learner.cc:553: +#> 11:06:46 | added cp and cpoe +#> 11:06:46 | added fixed drive variables +#> 11:06:46 | added series variables +#> • 11:06:46 | Cleaning up play-by-play... +#> 11:06:46 | Cleaning completed +#> 11:06:46 | added qb_epa +#> • 11:06:46 | Computing xyac... +#> [11:06:48] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -263,9 +263,9 @@

Examples#> #> for more details about differences between saving model and serializing. #> -#> 10:53:03 | added xyac variables -#> • 10:53:03 | Computing xpass... -#> [10:53:03] WARNING: src/learner.cc:553: +#> 11:06:48 | added xyac variables +#> • 11:06:48 | Computing xpass... +#> [11:06:49] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: @@ -274,12 +274,12 @@

Examples#> #> for more details about differences between saving model and serializing. #> -#> 10:53:03 | added xpass and pass_oe -#> • 10:53:03 | Decode player ids... -#> 10:53:03 | Decoding of player ids completed +#> 11:06:49 | added xpass and pass_oe +#> • 11:06:49 | Decode player ids... +#> 11:06:50 | Decoding of player ids completed #> ── DONE ──────────────────────────────────────────────────────────────────────── #> ── nflverse play by play ─────────────────────────────────────────────────────── -#> Data updated: 2024-03-11 10:53:03 UTC +#> Data updated: 2024-03-11 11:06:50 UTC #> # A tibble: 349 × 372 #> play_id game_id old_game_id home_team away_team season_type week posteam #> <dbl> <chr> <chr> <chr> <chr> <chr> <int> <chr> @@ -310,30 +310,30 @@

Examples build_nflfastR_pbp() }) #> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.6.1.9007 ── -#> • 10:53:03 | Start download of 3 games... +#> • 11:06:50 | Start download of 3 games... #> It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan("multisession")`! Will go on sequentially... -#> 10:53:06 | Download finished. Adding variables... -#> 10:53:06 | added game variables -#> 10:53:06 | added nflscrapR variables -#> 10:53:06 | added ep variables -#> 10:53:07 | added air_yac_ep variables -#> 10:53:07 | added wp variables -#> 10:53:07 | added air_yac_wp variables -#> 10:53:07 | added cp and cpoe -#> 10:53:07 | added fixed drive variables -#> 10:53:07 | added series variables -#> • 10:53:07 | Cleaning up play-by-play... -#> 10:53:07 | Cleaning completed -#> 10:53:07 | added qb_epa -#> • 10:53:07 | Computing xyac... -#> 10:53:08 | added xyac variables -#> • 10:53:08 | Computing xpass... -#> 10:53:08 | added xpass and pass_oe -#> • 10:53:08 | Decode player ids... -#> 10:53:09 | Decoding of player ids completed +#> 11:06:52 | Download finished. Adding variables... +#> 11:06:52 | added game variables +#> 11:06:53 | added nflscrapR variables +#> 11:06:53 | added ep variables +#> 11:06:53 | added air_yac_ep variables +#> 11:06:53 | added wp variables +#> 11:06:53 | added air_yac_wp variables +#> 11:06:53 | added cp and cpoe +#> 11:06:53 | added fixed drive variables +#> 11:06:53 | added series variables +#> • 11:06:53 | Cleaning up play-by-play... +#> 11:06:54 | Cleaning completed +#> 11:06:54 | added qb_epa +#> • 11:06:54 | Computing xyac... +#> 11:06:55 | added xyac variables +#> • 11:06:55 | Computing xpass... +#> 11:06:55 | added xpass and pass_oe +#> • 11:06:55 | Decode player ids... +#> 11:06:55 | Decoding of player ids completed #> ── DONE ──────────────────────────────────────────────────────────────────────── #> ── nflverse play by play ─────────────────────────────────────────────────────── -#> Data updated: 2024-03-11 10:53:09 UTC +#> Data updated: 2024-03-11 11:06:55 UTC #> # A tibble: 539 × 372 #> play_id game_id old_game_id home_team away_team season_type week posteam #> <dbl> <chr> <chr> <chr> <chr> <chr> <int> <chr> diff --git a/reference/decode_player_ids.html b/reference/decode_player_ids.html index 1f47ea4b..83918454 100644 --- a/reference/decode_player_ids.html +++ b/reference/decode_player_ids.html @@ -180,8 +180,8 @@

Examples "32013030-2d30-3032-3739-3434d4d3846d" ) )) -#> • 10:53:50 | Decode player ids... -#> 10:53:50 | Decoding of player ids completed +#> • 11:07:38 | Decode player ids... +#> 11:07:38 | Decoding of player ids completed #> name id #> 1 P.Mahomes 00-0033873 #> 2 B.Baldwin <NA> diff --git a/reference/fast_scraper.html b/reference/fast_scraper.html index a0e19329..dd412297 100644 --- a/reference/fast_scraper.html +++ b/reference/fast_scraper.html @@ -1208,19 +1208,19 @@

Examplesfast_scraper(c("2019_01_GB_CHI", "2013_21_SEA_DEN")) }) #> It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan("multisession")`! Will go on sequentially... -#> 10:53:52 | Download finished. Adding variables... -#> 10:53:52 | added game variables -#> 10:53:52 | added nflscrapR variables -#> 10:53:53 | added ep variables -#> 10:53:53 | added air_yac_ep variables -#> 10:53:53 | added wp variables -#> 10:53:53 | added air_yac_wp variables -#> 10:53:53 | added cp and cpoe -#> 10:53:53 | added fixed drive variables -#> 10:53:53 | added series variables -#> 10:53:53 | Procedure completed. +#> 11:07:40 | Download finished. Adding variables... +#> 11:07:40 | added game variables +#> 11:07:40 | added nflscrapR variables +#> 11:07:40 | added ep variables +#> 11:07:40 | added air_yac_ep variables +#> 11:07:41 | added wp variables +#> 11:07:41 | added air_yac_wp variables +#> 11:07:41 | added cp and cpoe +#> 11:07:41 | added fixed drive variables +#> 11:07:41 | added series variables +#> 11:07:41 | Procedure completed. #> ── nflverse play by play ─────────────────────────────────────────────────────── -#> Data updated: 2024-03-11 10:53:53 UTC +#> Data updated: 2024-03-11 11:07:41 UTC #> # A tibble: 337 × 339 #> play_id game_id old_game_id home_team away_team season_type week posteam #> <dbl> <chr> <chr> <chr> <chr> <chr> <int> <chr> @@ -1252,19 +1252,19 @@

Examples fast_scraper() }) #> It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan("multisession")`! Will go on sequentially... -#> 10:53:56 | Download finished. Adding variables... -#> 10:53:56 | added game variables -#> 10:53:56 | added nflscrapR variables -#> 10:53:56 | added ep variables -#> 10:53:56 | added air_yac_ep variables -#> 10:53:57 | added wp variables -#> 10:53:57 | added air_yac_wp variables -#> 10:53:57 | added cp and cpoe -#> 10:53:57 | added fixed drive variables -#> 10:53:57 | added series variables -#> 10:53:57 | Procedure completed. +#> 11:07:43 | Download finished. Adding variables... +#> 11:07:43 | added game variables +#> 11:07:44 | added nflscrapR variables +#> 11:07:44 | added ep variables +#> 11:07:44 | added air_yac_ep variables +#> 11:07:44 | added wp variables +#> 11:07:44 | added air_yac_wp variables +#> 11:07:44 | added cp and cpoe +#> 11:07:44 | added fixed drive variables +#> 11:07:45 | added series variables +#> 11:07:45 | Procedure completed. #> ── nflverse play by play ─────────────────────────────────────────────────────── -#> Data updated: 2024-03-11 10:53:57 UTC +#> Data updated: 2024-03-11 11:07:45 UTC #> # A tibble: 539 × 339 #> play_id game_id old_game_id home_team away_team season_type week posteam #> <dbl> <chr> <chr> <chr> <chr> <chr> <int> <chr> diff --git a/reference/fast_scraper_schedules.html b/reference/fast_scraper_schedules.html index ce6e1aad..28c48187 100644 --- a/reference/fast_scraper_schedules.html +++ b/reference/fast_scraper_schedules.html @@ -148,7 +148,7 @@

Examplesfast_scraper_schedules(2015:2018) }) #> ── nflverse games and schedules ──────────────────────────────────────────────── -#> Data updated: 2024-03-11 10:53:59 UTC +#> Data updated: 2024-03-11 11:07:47 UTC #> # A tibble: 1,068 × 46 #> game_id season game_type week gameday weekday gametime away_team away_score #> <chr> <int> <chr> <int> <chr> <chr> <chr> <chr> <int> diff --git a/search.json b/search.json index fa393c4e..7b204bba 100644 --- a/search.json +++ b/search.json @@ -1 +1 @@ -[{"path":"https://www.nflfastr.com/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2020 Sebastian Carl; Ben Baldwin Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"A beginner's guide to nflfastR","text":"following guide assume R installed. also highly recommend working RStudio. need help getting installed unfamiliar RStudio laid , please see section Lee Sharpe’s guide. quick word ’re new programming: happening R. Obviously, need install R computer . Make sure save ’re script (RStudio, File –> New File –> R script) can save work run multiple lines code . run code script, highlight want, press control + enter press Run button top editor (see Lee’s guide). don’t highlight anything press control + enter, currently selected line run. go R journey, might get stuck google bunch things, ’s totally okay normal. ’s got started!","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"setup","dir":"Articles","previous_headings":"","what":"Setup","title":"A beginner's guide to nflfastR","text":"First, need install magic packages. need run step given computer. can just type RStudio console (look Console pane RStudio) directly since ’re never going .","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"install-packages","dir":"Articles","previous_headings":"Setup","what":"Install packages","title":"A beginner's guide to nflfastR","text":"","code":"install.packages(\"tidyverse\", type = \"binary\") install.packages(\"ggrepel\", type = \"binary\") install.packages(\"nflreadr\", type = \"binary\") install.packages(\"nflplotR\", type = \"binary\")"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"load-packages","dir":"Articles","previous_headings":"Setup","what":"Load packages","title":"A beginner's guide to nflfastR","text":"Okay, now ’s stuff ’re going want start putting R script. following loads tidyverse, contains lot helper functions working data ggrepel making figures, along nflreadr (allows one quickly download nflfastR data, along lot data). Finally, nflplotR makes plotting easier. one optional makes R prefer display numbers scientific notation, find annoying:","code":"library(tidyverse) library(ggrepel) library(nflreadr) library(nflplotR) options(scipen = 9999)"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"load-data","dir":"Articles","previous_headings":"Setup","what":"Load data","title":"A beginner's guide to nflfastR","text":"load full play play 2019 season (including playoffs). ’ll get get seasons later. Note downloading pre-cleaned data nflfastR data repository using load_pbp() function included nflreadr, much faster building pbp scratch.","code":"data <- load_pbp(2019)"},{"path":[]},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"dimensions","dir":"Articles","previous_headings":"Basics: how to look at your data","what":"Dimensions","title":"A beginner's guide to nflfastR","text":"moving forward, ways get sense ’s dataframe. can check dimensions data, tells us 47260 rows (.e., plays) data 372 columns (variables): str displays structure dataframe: , ’ve added [1:10], selects first 10 columns, otherwise list extremely long (remember 372 columns!). Normally, just type str(data). can similarly take glimpse data: ’m showing first 10 columns. usual command glimpse(data).","code":"dim(data) #> [1] 47260 372 str(data[1:10]) #> nflvrs_d [47,260 × 10] (S3: nflverse_data/tbl_df/tbl/data.table/data.frame) #> $ play_id : num [1:47260] 1 36 51 79 100 121 148 185 214 239 ... #> $ game_id : chr [1:47260] \"2019_01_ATL_MIN\" \"2019_01_ATL_MIN\" \"2019_01_ATL_MIN\" \"2019_01_ATL_MIN\" ... #> $ old_game_id : chr [1:47260] \"2019090804\" \"2019090804\" \"2019090804\" \"2019090804\" ... #> $ home_team : chr [1:47260] \"MIN\" \"MIN\" \"MIN\" \"MIN\" ... #> $ away_team : chr [1:47260] \"ATL\" \"ATL\" \"ATL\" \"ATL\" ... #> $ season_type : chr [1:47260] \"REG\" \"REG\" \"REG\" \"REG\" ... #> $ week : int [1:47260] 1 1 1 1 1 1 1 1 1 1 ... #> $ posteam : chr [1:47260] NA \"ATL\" \"ATL\" \"ATL\" ... #> $ posteam_type: chr [1:47260] NA \"away\" \"away\" \"away\" ... #> $ defteam : chr [1:47260] NA \"MIN\" \"MIN\" \"MIN\" ... #> - attr(*, \"nflverse_timestamp\")= POSIXct[1:1], format: \"2024-03-07 14:39:28\" #> - attr(*, \"nflverse_type\")= chr \"play by play data\" #> - attr(*, \"nflfastR_version\")=Classes 'package_version', 'numeric_version' hidden list of 1 #> ..$ : int [1:4] 4 6 1 9007 glimpse(data[1:10]) #> Rows: 47,260 #> Columns: 10 #> $ play_id 1, 36, 51, 79, 100, 121, 148, 185, 214, 239, 255, 277, 29… #> $ game_id \"2019_01_ATL_MIN\", \"2019_01_ATL_MIN\", \"2019_01_ATL_MIN\", … #> $ old_game_id \"2019090804\", \"2019090804\", \"2019090804\", \"2019090804\", \"… #> $ home_team \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"… #> $ away_team \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"… #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"… #> $ week 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, … #> $ posteam NA, \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"MIN\", \"MIN\", \"MIN… #> $ posteam_type NA, \"away\", \"away\", \"away\", \"away\", \"away\", \"home\", \"home… #> $ defteam NA, \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"ATL\", \"ATL\", \"ATL…"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"variable-names","dir":"Articles","previous_headings":"Basics: how to look at your data","what":"Variable names","title":"A beginner's guide to nflfastR","text":"Another useful command get names variables data, get entering names(data) (won’t show , , 372 columns). lot work !","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"viewer","dir":"Articles","previous_headings":"Basics: how to look at your data","what":"Viewer","title":"A beginner's guide to nflfastR","text":"One way look data View() function. ’re coming Excel background, help feel home way see ’s data. open viewer RStudio new panel. Try ! Since many columns, Viewer won’t show . pick columns view, can select : %>% thing lets pipe together bunch different commands. ’re taking data, “select”ing variables want look , Viewing. , can’t display results , try !","code":"View(data) data %>% select(home_team, away_team, posteam, desc) %>% View()"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"head-manipulation","dir":"Articles","previous_headings":"Basics: how to look at your data","what":"Head + manipulation","title":"A beginner's guide to nflfastR","text":"start, let’s just look first rows (“head”) data. couple things. “desc” important variable lists description happened play, head says show first rows (“head” data). Since already sorted game, first 6 rows week 1 game, ATL @ MIN. make code easier read, people often put part pipe new line, useful working complicated functions. run: return exact output one written multiple lines, code isn’t easy read. ’ve covered select, next important function learn filter, lets filter data want. following returns plays run plays pass plays; .e., punts, kickoffs, field goals, dead ball penalties (e.g. false starts) don’t know attempted play . Compared first time , opening line start game, kickoff, punt now gone. Note ’re checking whether variable equal something, need use double equals sign == like . ’s probably technical reason [shrug emoji]. Also, character | used “”, & “”. rush == 1 | pass == 1 means “rush pass”. Note rush, pass, name, passer, rusher, receiver columns nflfastR creations, provided make working data easier. can see , passer filled dropbacks (including sacks scrambles, also pass = 1), name equal passer pass plays rusher rush plays. Think primary player involved play. wanted view special teams plays? , can use filter: Fourth plays? Fourth plays aren’t special teams plays? far, ’ve just taking look initial dataset downloaded, none results preserved. save new dataframe just plays want, need use <- assign new dataframe. Let’s save new dataframe ’s just run plays pass plays non-missing EPA, called pbp_rp. , !.na(epa) means exclude plays missing (na) EPA. ! symbol often used computer folk negate something, .na(epa) means “EPA missing” !.na(epa) means “EPA missing”, used .","code":"data %>% select(posteam, defteam, desc, rush, pass) %>% head() #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 6 × 5 #> posteam defteam desc rush pass #> #> 1 NA NA GAME 0 0 #> 2 ATL MIN 5-D.Bailey kicks 65 yards from MIN 35 to end zone… 0 0 #> 3 ATL MIN (15:00) 2-M.Ryan sacked at ATL 17 for -8 yards (5… 0 1 #> 4 ATL MIN (14:20) 24-D.Freeman right tackle to ATL 21 for 4… 1 0 #> 5 ATL MIN (13:41) (Shotgun) 2-M.Ryan scrambles left end to … 0 1 #> 6 ATL MIN (12:59) 5-M.Bosher punt is BLOCKED by 50-E.Wilson… 0 0 data %>% select(posteam, defteam, desc, rush, pass) %>% head() data %>% filter(rush == 1 | pass == 1) %>% select(posteam, desc, rush, pass, name, passer, rusher, receiver) %>% head() #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 6 × 8 #> posteam desc rush pass name passer rusher receiver #> #> 1 ATL (15:00) 2-M.Ryan sacked at A… 0 1 M.Ry… M.Ryan NA NA #> 2 ATL (14:20) 24-D.Freeman right t… 1 0 D.Fr… NA D.Fre… NA #> 3 ATL (13:41) (Shotgun) 2-M.Ryan s… 0 1 M.Ry… M.Ryan NA NA #> 4 MIN (12:53) 33-D.Cook right end … 1 0 D.Co… NA D.Cook NA #> 5 MIN (12:32) 8-K.Cousins pass sho… 0 1 K.Co… K.Cou… NA D.Cook #> 6 MIN (11:57) 8-K.Cousins pass sho… 0 1 K.Co… K.Cou… NA A.Thiel… data %>% filter(special == 1) %>% select(down, ydstogo, desc) %>% head() #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 6 × 3 #> down ydstogo desc #> #> 1 NA 0 5-D.Bailey kicks 65 yards from MIN 35 to end zone, Touchback. #> 2 4 2 (12:59) 5-M.Bosher punt is BLOCKED by 50-E.Wilson, Center-47-J.… #> 3 NA 0 (Kick formation) 5-D.Bailey extra point is GOOD, Center-58-A.Cu… #> 4 NA 0 5-D.Bailey kicks 67 yards from MIN 35 to ATL -2. 38-K.Barner to… #> 5 NA 0 (Kick formation) 5-D.Bailey extra point is GOOD, Center-58-A.Cu… #> 6 NA 0 5-D.Bailey kicks 65 yards from MIN 35 to end zone, Touchback. data %>% filter(down == 4) %>% select(down, ydstogo, desc) %>% head() #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 6 × 3 #> down ydstogo desc #> #> 1 4 2 (12:59) 5-M.Bosher punt is BLOCKED by 50-E.Wilson, Center-47-J.… #> 2 4 19 (2:38) 5-M.Bosher punts 33 yards to MIN 8, Center-47-J.Harris, … #> 3 4 20 (12:33) 2-B.Colquitt punts 51 yards to ATL 17, Center-58-A.Cutt… #> 4 4 27 (1:49) 5-M.Bosher punts 45 yards to MIN 10, Center-47-J.Harris,… #> 5 4 10 (:49) 2-B.Colquitt punts 57 yards to ATL 33, Center-58-A.Cuttin… #> 6 4 1 (10:56) 2-B.Colquitt punts 42 yards to ATL 10, Center-58-A.Cutt… data %>% filter(down == 4 & special == 0) %>% select(down, ydstogo, desc) %>% head() #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 6 × 3 #> down ydstogo desc #> #> 1 4 5 (9:25) (Shotgun) 2-M.Ryan pass deep left to 18-C.Ridley for 20 … #> 2 4 2 (4:39) (Punt formation) PENALTY on MIN, Delay of Game, 5 yards,… #> 3 4 2 (1:27) (No Huddle, Shotgun) 2-M.Ryan pass short left to 11-J.Jo… #> 4 4 1 (2:59) (Punt formation) Direct snap to 41-A.Levine. 41-A.Levin… #> 5 4 3 (9:30) (Shotgun) 3-R.Griffin pass short left to 89-M.Andrews fo… #> 6 4 1 (3:55) 17-J.Allen FUMBLES (Aborted) at NYJ 37, RECOVERED by NYJ… pbp_rp <- data %>% filter(rush == 1 | pass == 1, !is.na(epa))"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"some-basic-stuff-part-1","dir":"Articles","previous_headings":"","what":"Some basic stuff: Part 1","title":"A beginner's guide to nflfastR","text":"Okay, big dataset call dropbacks pass plays non-dropbacks rush plays. Now actually want , like, stuff.","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"group-by-and-summarize","dir":"Articles","previous_headings":"Some basic stuff: Part 1","what":"Group by and Summarize","title":"A beginner's guide to nflfastR","text":"Let’s take look various Cowboys’ running backs fared run plays 2019: ’s lot going . ’ve covered filter already. group_by function extremely useful function , well, groups tell – case rusher. Summarize useful collapsing data summary ’re looking , , grouping player, ’re summarizing mean EPA, success, yardage (bad rushing stat, since ’re ), getting number plays using n(), returns number group. Unsurprisingly, Prescott much effective rusher 2019 running backs, meaningful difference Pollard Elliott efficiency. check PFR team stats page, ’ll notice doesn’t match official stats. nflfastR computes EPA provides player names plays penalties two-point conversions. wanting match official stats, need restrict <= 4 (excluded two-point conversions, listed NA) play_type = run (exclude penalties, play_type = no_play): Now exactly match PFR: Zeke 301 carries 4.5 yards/carry, Pollard 86 carries 5.3 yards/carry. Note still aren’t matching Dak’s stats PFR NFL classifies scrambles rush attempts nflfastR .","code":"pbp_rp %>% filter(posteam == \"DAL\", rush == 1) %>% group_by(rusher) %>% summarize( mean_epa = mean(epa), success_rate = mean(success), ypc = mean(yards_gained), plays = n() ) %>% arrange(-mean_epa) %>% filter(plays > 20) #> # A tibble: 3 × 5 #> rusher mean_epa success_rate ypc plays #> #> 1 D.Prescott 0.288 0.591 6.41 22 #> 2 T.Pollard -0.0265 0.456 5.08 90 #> 3 E.Elliott -0.0412 0.411 4.39 309 pbp_rp %>% filter(posteam == \"DAL\", down <= 4, play_type == 'run') %>% group_by(rusher) %>% summarize( mean_epa = mean(epa), success_rate = mean(success), ypc=mean(yards_gained), plays=n() ) %>% filter(plays > 20) #> # A tibble: 3 × 5 #> rusher mean_epa success_rate ypc plays #> #> 1 D.Prescott 0.288 0.591 6.41 22 #> 2 E.Elliott -0.0185 0.422 4.51 301 #> 3 T.Pollard -0.0210 0.453 5.29 86"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"manipulating-columns-mutate-if_else-and-case_when","dir":"Articles","previous_headings":"Some basic stuff: Part 1","what":"Manipulating columns: mutate, if_else, and case_when","title":"A beginner's guide to nflfastR","text":"Let’s say want make new column, named home, equal 1 team ball home team. Let’s introduce another extremely useful function, if_else: mutate R’s word creating new column (overwriting existing one); case, ’ve created new column called home. uses if_else, uses following pattern: condition (case, posteam == home_team), value condition true (case, posteam == home_team, 1), value condition false (0). use , example, look average EPA/play home road teams: Note EPA/play similar home teams away teams home already built nflfastR EPA model, result expected. Actually, away EPA/play actually somewhat higher, presumably away teams -performed usual 2019 homefield advantage continues decline generally. if_else nice ’re creating new column based simple condition. need something complicated? case_when good option. ’s works: Note new syntax case_when: condition (first one, air yards less 0), followed ~, followed assignment (first one, “Negative”). , created 4 bins based air yards got average completion probability (cp) based nflfastR model. Unsurprisingly, cp lower longer downfield throw goes.","code":"pbp_rp %>% mutate( home = if_else(posteam == home_team, 1, 0) ) %>% select(posteam, home_team, home) %>% head(10) #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 10 × 3 #> posteam home_team home #> #> 1 ATL MIN 0 #> 2 ATL MIN 0 #> 3 ATL MIN 0 #> 4 MIN MIN 1 #> 5 MIN MIN 1 #> 6 MIN MIN 1 #> 7 ATL MIN 0 #> 8 ATL MIN 0 #> 9 ATL MIN 0 #> 10 MIN MIN 1 pbp_rp %>% mutate( home = if_else(posteam == home_team, 1, 0) ) %>% group_by(home) %>% summarize(epa = mean(epa)) #> # A tibble: 2 × 2 #> home epa #> #> 1 0 0.0215 #> 2 1 -0.0158 pbp_rp %>% filter(!is.na(cp)) %>% mutate( depth = case_when( air_yards < 0 ~ \"Negative\", air_yards >= 0 & air_yards < 10 ~ \"Short\", air_yards >= 10 & air_yards < 20 ~ \"Medium\", air_yards >= 20 ~ \"Deep\" ) ) %>% group_by(depth) %>% summarize(cp = mean(cp)) #> # A tibble: 4 × 2 #> depth cp #> #> 1 Deep 0.367 #> 2 Medium 0.573 #> 3 Negative 0.847 #> 4 Short 0.718"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"a-basic-figure","dir":"Articles","previous_headings":"Some basic stuff: Part 1","what":"A basic figure","title":"A beginner's guide to nflfastR","text":"Now ’ve gained skills manipulating data, let’s put use making things. teams pass-heavy first half early downs win probability 20 80, excluding final 2 minutes half everyone pass-happy? , ’ve already used filter, group_by, summarize. new function using arrange, sorts data variable(s) given. minus sign front mean_pass means sort descending order. Let’s make first figure: image kind mess – still need title, axis labels, etc – gets point across. ’ll get stuff later. importantly, made something interesting using nflfastR data! “reorder” sorts teams according pass rate, “-” saying descending order. “aes” short “aesthetic”, R’s weird way asking variables go x y axes. Looking figure, Chiefs never playoff success establish run.","code":"schotty <- pbp_rp %>% filter(wp > .20 & wp < .80 & down <= 2 & qtr <= 2 & half_seconds_remaining > 120) %>% group_by(posteam) %>% summarize(mean_pass = mean(pass), plays = n()) %>% arrange(-mean_pass) schotty #> # A tibble: 32 × 3 #> posteam mean_pass plays #> #> 1 KC 0.691 388 #> 2 MIA 0.594 288 #> 3 NO 0.585 325 #> 4 LA 0.584 329 #> 5 CHI 0.561 310 #> 6 CLE 0.555 272 #> 7 CAR 0.554 271 #> 8 TB 0.551 321 #> 9 GB 0.550 291 #> 10 ARI 0.548 325 #> # ℹ 22 more rows ggplot(schotty, aes(x=reorder(posteam,-mean_pass), y=mean_pass)) + geom_text(aes(label=posteam))"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"loading-multiple-seasons","dir":"Articles","previous_headings":"","what":"Loading multiple seasons","title":"A beginner's guide to nflfastR","text":"data stored data repository, fast load data multiple seasons. loads play--play data 2015 2019 seasons. Let’s make sure got . now, understand : season 48,000 plays. Just fun, let’s look various play types:","code":"pbp <- load_pbp(2015:2019) pbp %>% group_by(season) %>% summarize(n = n()) #> # A tibble: 5 × 2 #> season n #> #> 1 2015 48122 #> 2 2016 47651 #> 3 2017 47242 #> 4 2018 47109 #> 5 2019 47260 pbp %>% group_by(play_type) %>% summarize(n = n()) #> # A tibble: 10 × 2 #> play_type n #> #> 1 extra_point 6240 #> 2 field_goal 5155 #> 3 kickoff 13614 #> 4 no_play 22745 #> 5 pass 99984 #> 6 punt 12083 #> 7 qb_kneel 2090 #> 8 qb_spike 340 #> 9 run 68128 #> 10 NA 7005"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"figures-with-qb-stats","dir":"Articles","previous_headings":"","what":"Figures with QB stats","title":"A beginner's guide to nflfastR","text":"Let’s stuff quarterbacks: Lots new stuff . First, ’re grouping id name make sure ’re getting unique players; .e., two players name (like Javorius Allen Josh Allen J.Allen), also using id differentiate . qb_epa nflfastR creation equal EPA instances except pass completed fumble lost, case QB gets “credit” play spot fumble lost (making EPA function like passing yards). last part summarize comment gets last team player observed playing . way getting dataset quarterbacks without joining external roster data make sure hit number dropbacks. case, filtering n_dropbacks > 100 makes sure ’re including quarterbacks. ungroup() near end good practice grouping make sure don’t get weird behavior data created line. Let’s make figures. load_teams() function provided nflreadr package, since already loaded package, ’s ready use. Let’s join qbs dataframe created: left_join means keep rows left dataframe (first one provided, qbs), join rows available rows dataframe. also need provide joining variables, team qbs team_abbr load_teams(). type = c('team' = 'team_abbr')? knows, ’s left_join requires instructions match.","code":"qbs <- pbp %>% filter(season_type == \"REG\", !is.na(epa)) %>% group_by(id, name) %>% summarize( epa = mean(qb_epa), cpoe = mean(cpoe, na.rm = T), n_dropbacks = sum(pass), n_plays = n(), team = last(posteam) ) %>% ungroup() %>% filter(n_dropbacks > 100 & n_plays > 1000) #> `summarise()` has grouped output by 'id'. You can override using the `.groups` #> argument. load_teams() #> ── nflverse team graphics ────────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 10:54:38 UTC #> # A tibble: 32 × 16 #> team_abbr team_name team_id team_nick team_conf team_division team_color #> #> 1 ARI Arizona Cardi… 3800 Cardinals NFC NFC West #97233F #> 2 ATL Atlanta Falco… 0200 Falcons NFC NFC South #A71930 #> 3 BAL Baltimore Rav… 0325 Ravens AFC AFC North #241773 #> 4 BUF Buffalo Bills 0610 Bills AFC AFC East #00338D #> 5 CAR Carolina Pant… 0750 Panthers NFC NFC South #0085CA #> 6 CHI Chicago Bears 0810 Bears NFC NFC North #0B162A #> 7 CIN Cincinnati Be… 0920 Bengals AFC AFC North #FB4F14 #> 8 CLE Cleveland Bro… 1050 Browns AFC AFC North #FF3C00 #> 9 DAL Dallas Cowboys 1200 Cowboys NFC NFC East #002244 #> 10 DEN Denver Broncos 1400 Broncos AFC AFC West #002244 #> # ℹ 22 more rows #> # ℹ 9 more variables: team_color2 , team_color3 , team_color4 , #> # team_logo_wikipedia , team_logo_espn , team_wordmark , #> # team_conference_logo , team_league_logo , team_logo_squared qbs <- qbs %>% left_join(load_teams(), by = c('team' = 'team_abbr'))"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"with-team-color-dots","dir":"Articles","previous_headings":"Figures with QB stats","what":"With team color dots","title":"A beginner's guide to nflfastR","text":"Now can make figure! looks complicated, just way getting bunch different stuff plot: lines averages, dots, names, etc. added comments explain going , practice making figures usually just copy paste stuff /google need.","code":"qbs %>% ggplot(aes(x = cpoe, y = epa)) + #horizontal line with mean EPA geom_hline(yintercept = mean(qbs$epa), color = \"red\", linetype = \"dashed\", alpha=0.5) + #vertical line with mean CPOE geom_vline(xintercept = mean(qbs$cpoe), color = \"red\", linetype = \"dashed\", alpha=0.5) + #add points for the QBs with the right colors #cex controls point size and alpha the transparency (alpha = 1 is normal) geom_point(color = qbs$team_color, cex=qbs$n_plays / 350, alpha = .6) + #add names using ggrepel, which tries to make them not overlap geom_text_repel(aes(label=name)) + #add a smooth line fitting cpoe + epa stat_smooth(geom='line', alpha=0.5, se=FALSE, method='lm')+ #titles and caption labs(x = \"Completion % above expected (CPOE)\", y = \"EPA per play (passes, rushes, and penalties)\", title = \"Quarterback Efficiency, 2015 - 2019\", caption = \"Data: @nflfastR\") + #uses the black and white ggplot theme theme_bw() + #center title with hjust = 0.5 theme( plot.title = element_text(size = 14, hjust = 0.5, face = \"bold\") ) + #make ticks look nice #if this doesn't work, `install.packages('scales')` scale_y_continuous(breaks = scales::pretty_breaks(n = 10)) + scale_x_continuous(breaks = scales::pretty_breaks(n = 10))"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"with-team-logos","dir":"Articles","previous_headings":"Figures with QB stats","what":"With team logos","title":"A beginner's guide to nflfastR","text":"also make plot team logos: changes ’ve made use geom_nfl_logos instead geom_point (figure right size images width part? Trial error). figure look better fewer players shown, point explaining stuff, let’s call good enough.","code":"qbs %>% ggplot(aes(x = cpoe, y = epa)) + #horizontal line with mean EPA geom_hline(yintercept = mean(qbs$epa), color = \"red\", linetype = \"dashed\", alpha=0.5) + #vertical line with mean CPOE geom_vline(xintercept = mean(qbs$cpoe), color = \"red\", linetype = \"dashed\", alpha=0.5) + #add points for the QBs with the logos (this uses nflplotR package) geom_nfl_logos(aes(team_abbr = team), width = qbs$n_plays / 45000, alpha = 0.75) + #add names using ggrepel, which tries to make them not overlap geom_text_repel(aes(label=name)) + #add a smooth line fitting cpoe + epa stat_smooth(geom='line', alpha=0.5, se=FALSE, method='lm')+ #titles and caption labs(x = \"Completion % above expected (CPOE)\", y = \"EPA per play (passes, rushes, and penalties)\", title = \"Quarterback Efficiency, 2015 - 2019\", caption = \"Data: @nflfastR\") + theme_bw() + #center title theme( plot.title = element_text(size = 14, hjust = 0.5, face = \"bold\") ) + #make ticks look nice scale_y_continuous(breaks = scales::pretty_breaks(n = 10)) + scale_x_continuous(breaks = scales::pretty_breaks(n = 10))"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"team-tiers-plot","dir":"Articles","previous_headings":"Figures with QB stats","what":"Team tiers plot","title":"A beginner's guide to nflfastR","text":"’s helpful, notes chart originally shown , like uses nflplotR team logos. geom_mean_lines() function adds mean lines offensive defensive EPA per play slope lines created using geom_abline() scale_y_reverse() reverses vertical axis = better defense Everything else comprehensible now!","code":"library(nflplotR) # get pbp and filter to regular season rush and pass plays pbp <- nflreadr::load_pbp(2005) %>% dplyr::filter(season_type == \"REG\") %>% dplyr::filter(!is.na(posteam) & (rush == 1 | pass == 1)) # offense epa offense <- pbp %>% dplyr::group_by(team = posteam) %>% dplyr::summarise(off_epa = mean(epa, na.rm = TRUE)) # defense epa defense <- pbp %>% dplyr::group_by(team = defteam) %>% dplyr::summarise(def_epa = mean(epa, na.rm = TRUE)) # make figure offense %>% dplyr::inner_join(defense, by = \"team\") %>% ggplot2::ggplot(aes(x = off_epa, y = def_epa)) + # tier lines ggplot2::geom_abline(slope = -1.5, intercept = (4:-3)/10, alpha = .2) + # nflplotR magic nflplotR::geom_mean_lines(aes(y0 = off_epa, x0 = def_epa)) + nflplotR::geom_nfl_logos(aes(team_abbr = team), width = 0.07, alpha = 0.7) + ggplot2::labs( x = \"Offense EPA/play\", y = \"Defense EPA/play\", caption = \"Data: @nflfastR\", title = \"2005 NFL Offensive and Defensive EPA per Play\" ) + ggplot2::theme_bw() + ggplot2::theme( plot.title = ggplot2::element_text(size = 12, hjust = 0.5, face = \"bold\") ) + ggplot2::scale_y_reverse()"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"a-few-more-things-on-plotting","dir":"Articles","previous_headings":"Figures with QB stats","what":"A few more things on plotting","title":"A beginner's guide to nflfastR","text":"two ways view plots. One RStudio Viewer, shows RStudio plot something. plots RStudio viewer look ugly pixelated, probably need install Cairo package set default viewer Tools –> Global Options –> General –> Graphics –> Backend: Set Cairo. save .png preferred dimensions resolution. example, ggsave(\"test.png\", width = 16, height = 9, units = \"cm\") save current plot “test.png” units specified (can view ggsave options ). One note: RStudio Viewer can take long time preview ggplots, especially ’re things like adding images. ’re getting frustrated plot taking long time display, can take advantage ggpreview nflplotR. , first save plot object run ggpreview (doesn’t make sense, see examples ).","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"real-life-example-lets-make-a-win-total-model","dir":"Articles","previous_headings":"","what":"Real life example: let’s make a win total model","title":"A beginner's guide to nflfastR","text":"’m going try go process cleaning joining multiple data sets try get sense approach something like , step--step.","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"get-team-wins-each-season","dir":"Articles","previous_headings":"Real life example: let’s make a win total model","what":"Get team wins each season","title":"A beginner's guide to nflfastR","text":"’re going cheat little take advantage Lee Sharpe’s famous games file. stuff added nflfastR, ’s easier working file game one row. ’re curious, triple colon way access referred non-exported functions package. Think like secret menu (secret? Sometimes package developers want limit number exported functions overwhelming). start, want create dataframe row team-season observation, listing many games won. multiple ways , ’m going just take home away results bind together. example, ’s home results look like: Note used rename change home_team team. away teams, need flip result since result given perspective home team. Now let’s make columns called win based result. results %>% filter(season == 2019 & team == 'SEA') part end isn’t actually saving data new form, just making sure previous step wanted. good habit get : frequently inspect data make sure looks like think . Now dataframe wanted, can get team wins season easily: , ’re making sure data looks like “” checking 5 seasons wins, making sure looks right. Now team-season win point differential data ready, need go back nflfastR data get EPA/play.","code":"games <- nflreadr::load_schedules() str(games) #> nflvrs_d [6,706 × 46] (S3: nflverse_data/tbl_df/tbl/data.table/data.frame) #> $ game_id : chr [1:6706] \"1999_01_MIN_ATL\" \"1999_01_KC_CHI\" \"1999_01_PIT_CLE\" \"1999_01_OAK_GB\" ... #> $ season : int [1:6706] 1999 1999 1999 1999 1999 1999 1999 1999 1999 1999 ... #> $ game_type : chr [1:6706] \"REG\" \"REG\" \"REG\" \"REG\" ... #> $ week : int [1:6706] 1 1 1 1 1 1 1 1 1 1 ... #> $ gameday : chr [1:6706] \"1999-09-12\" \"1999-09-12\" \"1999-09-12\" \"1999-09-12\" ... #> $ weekday : chr [1:6706] \"Sunday\" \"Sunday\" \"Sunday\" \"Sunday\" ... #> $ gametime : chr [1:6706] NA NA NA NA ... #> $ away_team : chr [1:6706] \"MIN\" \"KC\" \"PIT\" \"OAK\" ... #> $ away_score : int [1:6706] 17 17 43 24 14 3 10 30 25 28 ... #> $ home_team : chr [1:6706] \"ATL\" \"CHI\" \"CLE\" \"GB\" ... #> $ home_score : int [1:6706] 14 20 0 28 31 41 19 28 24 20 ... #> $ location : chr [1:6706] \"Home\" \"Home\" \"Home\" \"Home\" ... #> $ result : int [1:6706] -3 3 -43 4 17 38 9 -2 -1 -8 ... #> $ total : int [1:6706] 31 37 43 52 45 44 29 58 49 48 ... #> $ overtime : int [1:6706] 0 0 0 0 0 0 0 0 0 0 ... #> $ old_game_id : chr [1:6706] \"1999091210\" \"1999091206\" \"1999091213\" \"1999091208\" ... #> $ gsis : int [1:6706] 598 597 604 602 591 603 592 600 588 596 ... #> $ nfl_detail_id : chr [1:6706] NA NA NA NA ... #> $ pfr : chr [1:6706] \"199909120atl\" \"199909120chi\" \"199909120cle\" \"199909120gnb\" ... #> $ pff : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ espn : chr [1:6706] \"190912001\" \"190912003\" \"190912005\" \"190912009\" ... #> $ ftn : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ away_rest : int [1:6706] 7 7 7 7 7 7 7 7 7 7 ... #> $ home_rest : int [1:6706] 7 7 7 7 7 7 7 7 7 7 ... #> $ away_moneyline : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ home_moneyline : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ spread_line : num [1:6706] -4 -3 -6 9 -3 5.5 3.5 7 -3 9.5 ... #> $ away_spread_odds: int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ home_spread_odds: int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ total_line : num [1:6706] 49 38 37 43 45.5 49 38 44.5 37 42 ... #> $ under_odds : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ over_odds : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ div_game : int [1:6706] 0 0 1 0 1 0 1 1 1 0 ... #> $ roof : chr [1:6706] \"dome\" \"outdoors\" \"outdoors\" \"outdoors\" ... #> $ surface : chr [1:6706] \"astroturf\" \"grass\" \"grass\" \"grass\" ... #> $ temp : int [1:6706] NA 80 78 67 NA 76 NA 73 75 NA ... #> $ wind : int [1:6706] NA 12 12 10 NA 8 NA 5 3 NA ... #> $ away_qb_id : chr [1:6706] \"00-0003761\" \"00-0006300\" \"00-0015700\" \"00-0005741\" ... #> $ home_qb_id : chr [1:6706] \"00-0002876\" \"00-0010560\" \"00-0004230\" \"00-0005106\" ... #> $ away_qb_name : chr [1:6706] \"Randall Cunningham\" \"Elvis Grbac\" \"Kordell Stewart\" \"Rich Gannon\" ... #> $ home_qb_name : chr [1:6706] \"Chris Chandler\" \"Shane Matthews\" \"Ty Detmer\" \"Brett Favre\" ... #> $ away_coach : chr [1:6706] \"Dennis Green\" \"Gunther Cunningham\" \"Bill Cowher\" \"Jon Gruden\" ... #> $ home_coach : chr [1:6706] \"Dan Reeves\" \"Dick Jauron\" \"Chris Palmer\" \"Ray Rhodes\" ... #> $ referee : chr [1:6706] \"Gerry Austin\" \"Phil Luckett\" \"Bob McElwee\" \"Tony Corrente\" ... #> $ stadium_id : chr [1:6706] \"ATL00\" \"CHI98\" \"CLE00\" \"GNB00\" ... #> $ stadium : chr [1:6706] \"Georgia Dome\" \"Soldier Field\" \"Cleveland Browns Stadium\" \"Lambeau Field\" ... #> - attr(*, \"nflverse_type\")= chr \"games and schedules\" #> - attr(*, \"nflverse_timestamp\")= POSIXct[1:1], format: \"2024-03-11 10:55:05\" home <- games %>% filter(game_type == 'REG') %>% select(season, week, home_team, result) %>% rename(team = home_team) home %>% head(5) #> ── nflverse games and schedules ──────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 10:55:05 UTC #> # A tibble: 5 × 4 #> season week team result #> #> 1 1999 1 ATL -3 #> 2 1999 1 CHI 3 #> 3 1999 1 CLE -43 #> 4 1999 1 GB 4 #> 5 1999 1 IND 17 away <- games %>% filter(game_type == 'REG') %>% select(season, week, away_team, result) %>% rename(team = away_team) %>% mutate(result = -result) away %>% head(5) #> ── nflverse games and schedules ──────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 10:55:05 UTC #> # A tibble: 5 × 4 #> season week team result #> #> 1 1999 1 MIN 3 #> 2 1999 1 KC -3 #> 3 1999 1 PIT 43 #> 4 1999 1 OAK -4 #> 5 1999 1 BUF -17 results <- bind_rows(home, away) %>% arrange(week) %>% mutate( win = case_when( result > 0 ~ 1, result < 0 ~ 0, result == 0 ~ 0.5 ) ) results %>% filter(season == 2019 & team == 'SEA') #> ── nflverse games and schedules ──────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 10:55:05 UTC #> # A tibble: 16 × 5 #> season week team result win #> #> 1 2019 1 SEA 1 1 #> 2 2019 2 SEA 2 1 #> 3 2019 3 SEA -6 0 #> 4 2019 4 SEA 17 1 #> 5 2019 5 SEA 1 1 #> 6 2019 6 SEA 4 1 #> 7 2019 7 SEA -14 0 #> 8 2019 8 SEA 7 1 #> 9 2019 9 SEA 6 1 #> 10 2019 10 SEA 3 1 #> 11 2019 12 SEA 8 1 #> 12 2019 13 SEA 7 1 #> 13 2019 14 SEA -16 0 #> 14 2019 15 SEA 6 1 #> 15 2019 16 SEA -14 0 #> 16 2019 17 SEA -5 0 team_wins <- results %>% group_by(team, season) %>% summarize( wins = sum(win), point_diff = sum(result)) %>% ungroup() #> `summarise()` has grouped output by 'team'. You can override using the #> `.groups` argument. team_wins %>% arrange(-wins) %>% head(5) #> # A tibble: 5 × 4 #> team season wins point_diff #> #> 1 NE 2007 16 315 #> 2 CAR 2015 15 192 #> 3 GB 2011 15 201 #> 4 PIT 2004 15 121 #> 5 BAL 2019 14 249"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"get-team-epa-by-season","dir":"Articles","previous_headings":"Real life example: let’s make a win total model","what":"Get team EPA by season","title":"A beginner's guide to nflfastR","text":"Let’s start getting data every season nflfastR data repository: ’m pretty aggressive dropping rows columns (filter select) otherwise loading memory can painful computer. need ’re . Note ’m keeping regular season games (season_type == \"REG\") since analysis usually done. Now can get EPA/play offense defense. Let’s break pass rush . don’t remember let’s steps. know need group team, season, pass, ’s beginning: makes two rows per team-season. get team-season row? pivot_wider need: one hard wrap head around usually open reference page, read example, pray try works. case . Hooray! turned two-lines-per-team dataframe one, 0 column pass == 0 (run plays) 1 column pass == 1. Now let’s rename something sensible save: Note variable names numbers need surrounded tick marks work. Now can repeat process defense: Let’s another sanity check looking top 5 pass offenses defenses: top pass defenses (2002 TB, 2017 JAX, 2019 NE) offenses (2007 Pats, 2004 Colts, 2011 Packers) definitely check !","code":"pbp <- load_pbp(1999:2019) %>% filter(rush == 1 | pass == 1, season_type == \"REG\", !is.na(epa), !is.na(posteam), posteam != \"\") %>% select(season, posteam, pass, defteam, epa) pbp %>% group_by(posteam, season, pass) %>% summarize(epa = mean(epa)) %>% head(4) #> `summarise()` has grouped output by 'posteam', 'season'. You can override using #> the `.groups` argument. #> # A tibble: 4 × 4 #> # Groups: posteam, season [2] #> posteam season pass epa #> #> 1 ARI 1999 0 -0.201 #> 2 ARI 1999 1 -0.162 #> 3 ARI 2000 0 -0.240 #> 4 ARI 2000 1 -0.0718 pbp %>% group_by(posteam, season, pass) %>% summarize(epa = mean(epa)) %>% pivot_wider(names_from = pass, values_from = epa) %>% head(4) #> `summarise()` has grouped output by 'posteam', 'season'. You can override using #> the `.groups` argument. #> # A tibble: 4 × 4 #> # Groups: posteam, season [4] #> posteam season `0` `1` #> #> 1 ARI 1999 -0.201 -0.162 #> 2 ARI 2000 -0.240 -0.0718 #> 3 ARI 2001 -0.177 0.0740 #> 4 ARI 2002 -0.134 -0.0661 offense <- pbp %>% group_by(posteam, season, pass) %>% summarize(epa = mean(epa)) %>% pivot_wider(names_from = pass, values_from = epa) %>% rename(off_pass_epa = `1`, off_rush_epa = `0`) #> `summarise()` has grouped output by 'posteam', 'season'. You can override using #> the `.groups` argument. defense <- pbp %>% group_by(defteam, season, pass) %>% summarize(epa = mean(epa)) %>% pivot_wider(names_from = pass, values_from = epa) %>% rename(def_pass_epa = `1`, def_rush_epa = `0`) #> `summarise()` has grouped output by 'defteam', 'season'. You can override using #> the `.groups` argument. #top 5 offenses offense %>% arrange(-off_pass_epa) %>% head(5) #> # A tibble: 5 × 4 #> # Groups: posteam, season [5] #> posteam season off_rush_epa off_pass_epa #> #> 1 NE 2007 0.00380 0.422 #> 2 IND 2004 -0.00125 0.413 #> 3 GB 2011 -0.114 0.412 #> 4 KC 2018 0.0209 0.348 #> 5 DEN 2013 -0.0296 0.343 #top 5 defenses defense %>% arrange(def_pass_epa) %>% head(5) #> # A tibble: 5 × 4 #> # Groups: defteam, season [5] #> defteam season def_rush_epa def_pass_epa #> #> 1 TB 2002 -0.0756 -0.292 #> 2 NE 2019 -0.168 -0.241 #> 3 JAX 2017 -0.141 -0.223 #> 4 NYJ 2009 -0.104 -0.220 #> 5 LA 2003 -0.0548 -0.214"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"fix-team-names-and-join","dir":"Articles","previous_headings":"Real life example: let’s make a win total model","what":"Fix team names and join","title":"A beginner's guide to nflfastR","text":"Now ’re ready bind together. Actually, let’s make sure team names ready . Nope, yet, need fix Raiders, Rams, Chargers, LV, LA, LAC nflfastR. TRUE statement bottom says none cases found, keep team . Let’s make sure worked: HOU 3 fewer seasons didn’t exist 1999 2001, fine, team names number seasons . Okay NOW can join: Now ’re getting really close want! Next need create new columns prior year EPA, let’s point differential . Finally! Now data place can start things .","code":"team_wins %>% group_by(team) %>% summarize(n=n()) %>% arrange(n) #> # A tibble: 35 × 2 #> team n #> #> 1 LV 4 #> 2 LAC 7 #> 3 LA 8 #> 4 STL 17 #> 5 SD 18 #> 6 OAK 21 #> 7 HOU 22 #> 8 ARI 25 #> 9 ATL 25 #> 10 BAL 25 #> # ℹ 25 more rows team_wins <- team_wins %>% mutate( team = case_when( team == 'OAK' ~ 'LV', team == 'SD' ~ 'LAC', team == 'STL' ~ 'LA', TRUE ~ team ) ) team_wins %>% group_by(team) %>% summarize(n=n()) %>% arrange(n) #> # A tibble: 32 × 2 #> team n #> #> 1 HOU 22 #> 2 ARI 25 #> 3 ATL 25 #> 4 BAL 25 #> 5 BUF 25 #> 6 CAR 25 #> 7 CHI 25 #> 8 CIN 25 #> 9 CLE 25 #> 10 DAL 25 #> # ℹ 22 more rows data <- team_wins %>% left_join(offense, by = c('team' = 'posteam', 'season')) %>% left_join(defense, by = c('team' = 'defteam', 'season')) data %>% filter(team == 'SEA' & season >= 2012) #> # A tibble: 12 × 8 #> team season wins point_diff off_rush_epa off_pass_epa def_rush_epa #> #> 1 SEA 2012 11 167 -0.00476 0.213 -0.0738 #> 2 SEA 2013 13 186 -0.101 0.188 -0.128 #> 3 SEA 2014 12 140 0.0295 0.139 -0.231 #> 4 SEA 2015 10 146 -0.104 0.249 -0.148 #> 5 SEA 2016 10.5 62 -0.126 0.102 -0.207 #> 6 SEA 2017 9 34 -0.192 0.0584 -0.122 #> 7 SEA 2018 10 81 -0.0273 0.210 -0.130 #> 8 SEA 2019 11 7 -0.136 0.119 -0.0930 #> 9 SEA 2020 12 88 NA NA NA #> 10 SEA 2021 7 29 NA NA NA #> 11 SEA 2022 9 6 NA NA NA #> 12 SEA 2023 9 -38 NA NA NA #> # ℹ 1 more variable: def_pass_epa data <- data %>% arrange(team, season) %>% group_by(team) %>% mutate( prior_off_rush_epa = lag(off_rush_epa), prior_off_pass_epa = lag(off_pass_epa), prior_def_rush_epa = lag(def_rush_epa), prior_def_pass_epa = lag(def_pass_epa), prior_point_diff = lag(point_diff) ) %>% ungroup() data %>% head(5) #> # A tibble: 5 × 13 #> team season wins point_diff off_rush_epa off_pass_epa def_rush_epa #> #> 1 ARI 1999 6 -137 -0.201 -0.162 -0.0105 #> 2 ARI 2000 3 -233 -0.240 -0.0718 0.0333 #> 3 ARI 2001 7 -48 -0.177 0.0740 -0.0689 #> 4 ARI 2002 5 -155 -0.134 -0.0661 -0.0192 #> 5 ARI 2003 4 -227 -0.219 -0.120 -0.0627 #> # ℹ 6 more variables: def_pass_epa , prior_off_rush_epa , #> # prior_off_pass_epa , prior_def_rush_epa , #> # prior_def_pass_epa , prior_point_diff "},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"correlations-and-regressions","dir":"Articles","previous_headings":"Real life example: let’s make a win total model","what":"Correlations and regressions","title":"A beginner's guide to nflfastR","text":"’ve covered select, see new use minus sign de-selects variables (need de-select team name correlation work doesn’t work character strings, correlation season number meaningless). ’ve run correlation dataframe, removing missing values, rounding 2 digits. surprisingly, see wins current season strongly related passing offense EPA rushing EPA defense EPA, prior offense carries predictive power prior defense. Pass offense stable year year (0.46) rush offense (0.32), pass defense (0.28), rush defense (0.27). ’m actually surprised values passing offense aren’t higher relative others. Maybe prior results come nflscrapR era (2009 - 2019)? Let’s check looks like since 2009 relative earlier seasons: Yep, seems case. recent period, passing offense become slightly stable predictive following-year success, time rushing offense become substantially less stable less predictive future team success. Now let’s basic regression wins prior offense defense EPA/play. Maybe look recent period fit model since ’s relevant 2020. real world, rigorous making decisions like , let’s proceed anyway. ’m actually pretty surprised passing offense isn’t higher . compare simply using point differential? R2 somewhat higher just point differential. isn’t surprising ’ve thrown away special teams plays haven’t attempted make adjustments things like fumble luck know can improve EPA’s predictive power.","code":"data %>% select(-team, -season) %>% cor(use=\"complete.obs\") %>% round(2) #> wins point_diff off_rush_epa off_pass_epa def_rush_epa #> wins 1.00 0.92 0.43 0.70 -0.29 #> point_diff 0.92 1.00 0.48 0.76 -0.33 #> off_rush_epa 0.43 0.48 1.00 0.40 0.06 #> off_pass_epa 0.70 0.76 0.40 1.00 -0.01 #> def_rush_epa -0.29 -0.33 0.06 -0.01 1.00 #> def_pass_epa -0.57 -0.62 -0.04 -0.10 0.31 #> prior_off_rush_epa 0.23 0.26 0.32 0.23 0.02 #> prior_off_pass_epa 0.29 0.32 0.18 0.46 -0.01 #> prior_def_rush_epa -0.12 -0.15 0.03 -0.04 0.27 #> prior_def_pass_epa -0.18 -0.20 -0.07 -0.05 0.05 #> prior_point_diff 0.36 0.41 0.22 0.36 -0.09 #> def_pass_epa prior_off_rush_epa prior_off_pass_epa #> wins -0.57 0.23 0.29 #> point_diff -0.62 0.26 0.32 #> off_rush_epa -0.04 0.32 0.18 #> off_pass_epa -0.10 0.23 0.46 #> def_rush_epa 0.31 0.02 -0.01 #> def_pass_epa 1.00 -0.09 0.00 #> prior_off_rush_epa -0.09 1.00 0.41 #> prior_off_pass_epa 0.00 0.41 1.00 #> prior_def_rush_epa 0.16 0.05 -0.01 #> prior_def_pass_epa 0.28 0.00 -0.09 #> prior_point_diff -0.19 0.47 0.76 #> prior_def_rush_epa prior_def_pass_epa prior_point_diff #> wins -0.12 -0.18 0.36 #> point_diff -0.15 -0.20 0.41 #> off_rush_epa 0.03 -0.07 0.22 #> off_pass_epa -0.04 -0.05 0.36 #> def_rush_epa 0.27 0.05 -0.09 #> def_pass_epa 0.16 0.28 -0.19 #> prior_off_rush_epa 0.05 0.00 0.47 #> prior_off_pass_epa -0.01 -0.09 0.76 #> prior_def_rush_epa 1.00 0.32 -0.34 #> prior_def_pass_epa 0.32 1.00 -0.60 #> prior_point_diff -0.34 -0.60 1.00 message(\"2009 through 2019\") #> 2009 through 2019 data %>% filter(season >= 2009) %>% select(wins, point_diff, off_pass_epa, off_rush_epa, prior_point_diff, prior_off_pass_epa, prior_off_rush_epa) %>% cor(use=\"complete.obs\") %>% round(2) #> wins point_diff off_pass_epa off_rush_epa prior_point_diff #> wins 1.00 0.92 0.73 0.40 0.43 #> point_diff 0.92 1.00 0.79 0.46 0.44 #> off_pass_epa 0.73 0.79 1.00 0.37 0.38 #> off_rush_epa 0.40 0.46 0.37 1.00 0.19 #> prior_point_diff 0.43 0.44 0.38 0.19 1.00 #> prior_off_pass_epa 0.34 0.36 0.45 0.10 0.78 #> prior_off_rush_epa 0.24 0.25 0.17 0.24 0.45 #> prior_off_pass_epa prior_off_rush_epa #> wins 0.34 0.24 #> point_diff 0.36 0.25 #> off_pass_epa 0.45 0.17 #> off_rush_epa 0.10 0.24 #> prior_point_diff 0.78 0.45 #> prior_off_pass_epa 1.00 0.35 #> prior_off_rush_epa 0.35 1.00 message(\"1999 through 2008\") #> 1999 through 2008 data %>% filter(season < 2009) %>% select(wins, point_diff, off_pass_epa, off_rush_epa, prior_point_diff, prior_off_pass_epa, prior_off_rush_epa) %>% cor(use=\"complete.obs\") %>% round(2) #> wins point_diff off_pass_epa off_rush_epa prior_point_diff #> wins 1.00 0.92 0.68 0.47 0.28 #> point_diff 0.92 1.00 0.73 0.51 0.36 #> off_pass_epa 0.68 0.73 1.00 0.47 0.34 #> off_rush_epa 0.47 0.51 0.47 1.00 0.25 #> prior_point_diff 0.28 0.36 0.34 0.25 1.00 #> prior_off_pass_epa 0.23 0.29 0.45 0.30 0.74 #> prior_off_rush_epa 0.23 0.28 0.30 0.40 0.50 #> prior_off_pass_epa prior_off_rush_epa #> wins 0.23 0.23 #> point_diff 0.29 0.28 #> off_pass_epa 0.45 0.30 #> off_rush_epa 0.30 0.40 #> prior_point_diff 0.74 0.50 #> prior_off_pass_epa 1.00 0.48 #> prior_off_rush_epa 0.48 1.00 data <- data %>% filter(season >= 2009) fit <- lm(wins ~ prior_off_pass_epa + prior_off_rush_epa + prior_def_pass_epa + prior_def_rush_epa, data = data) summary(fit) #> #> Call: #> lm(formula = wins ~ prior_off_pass_epa + prior_off_rush_epa + #> prior_def_pass_epa + prior_def_rush_epa, data = data) #> #> Residuals: #> Min 1Q Median 3Q Max #> -7.7060 -1.8889 0.0678 2.2456 7.0869 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 7.9690 0.3883 20.524 < 0.0000000000000002 *** #> prior_off_pass_epa 6.5727 1.2784 5.141 0.000000438 *** #> prior_off_rush_epa 6.0275 2.2705 2.655 0.00827 ** #> prior_def_pass_epa -4.0837 1.6455 -2.482 0.01351 * #> prior_def_rush_epa -5.1531 2.3288 -2.213 0.02751 * #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> #> Residual standard error: 2.859 on 379 degrees of freedom #> (96 observations deleted due to missingness) #> Multiple R-squared: 0.164, Adjusted R-squared: 0.1552 #> F-statistic: 18.58 on 4 and 379 DF, p-value: 0.0000000000000584 fit2 <- lm(wins ~ prior_point_diff, data = data) summary(fit2) #> #> Call: #> lm(formula = wins ~ prior_point_diff, data = data) #> #> Residuals: #> Min 1Q Median 3Q Max #> -7.2007 -1.9624 0.1361 2.1952 7.3562 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 8.097917 0.126658 63.94 <0.0000000000000002 *** #> prior_point_diff 0.012974 0.001254 10.35 <0.0000000000000002 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> #> Residual standard error: 2.775 on 478 degrees of freedom #> Multiple R-squared: 0.183, Adjusted R-squared: 0.1813 #> F-statistic: 107.1 on 1 and 478 DF, p-value: < 0.00000000000000022"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"predictions","dir":"Articles","previous_headings":"Real life example: let’s make a win total model","what":"Predictions","title":"A beginner's guide to nflfastR","text":"Now let’s get predictions EPA model: mostly checks . just used simple point differential predict? surprisingly, looks pretty similar. basic models don’t incorporate schedule, roster changes, etc. example, better model take account Tom Brady longer playing Patriots. hopefully useful!","code":"preds <- predict(fit, data %>% filter(season == 2020)) %>% #was just a vector, need a tibble to bind as_tibble() %>% #make the column name make sense rename(prediction = value) %>% round(1) %>% #get names bind_cols( data %>% filter(season == 2020) %>% select(team) ) preds %>% arrange(-prediction) %>% head(5) #> # A tibble: 5 × 2 #> prediction team #> #> 1 11.5 BAL #> 2 10.2 SF #> 3 9.8 NE #> 4 9.6 DAL #> 5 9.6 NO preds2 <- predict(fit2, data %>% filter(season == 2020)) %>% #was just a vector, need a tibble to bind as_tibble() %>% #make the column name make sense rename(prediction = value) %>% round(1) %>% #get names bind_cols( data %>% filter(season == 2020) %>% select(team) ) preds2 %>% arrange(-prediction) %>% head(5) #> # A tibble: 5 × 2 #> prediction team #> #> 1 11.3 BAL #> 2 10.6 NE #> 3 10.3 SF #> 4 10 KC #> 5 9.6 DAL"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"next-steps","dir":"Articles","previous_headings":"","what":"Next Steps","title":"A beginner's guide to nflfastR","text":"now know enough able tackle great deal questions using nflfastR data. good way build skills take interesting things see try replicate (making figures, also involve heavy dose googling stuff). Looking others’ code also good way learn. One option look nflfastR code base, much now understand ’s . example, function cleans data prepares later stages: ’s heavy dose mutate, group_by, arrange, lag, if_else, case_when.","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"resources-the-gold-standards","dir":"Articles","previous_headings":"Next Steps","what":"Resources: The gold standards","title":"A beginner's guide to nflfastR","text":"R package section pretty R heavy. Introduction R (recommended) Open Source Football: Mix R Python Mockup Blog (Thomas Mock): Invaluable resource making cool stuff R","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"code-examples-r","dir":"Articles","previous_headings":"Next Steps","what":"Code examples: R","title":"A beginner's guide to nflfastR","text":"Lee Sharpe: basic intro R RStudio Lee Sharpe: lots useful NFL / nflscrapR code Lee Sharpe: update current season games Josh Hermsmeyer: Getting Started R NFL Analysis Slavin: visualizing positional tiers SFB9 Ron Yurko: assorted examples CowboysStats: defensive playmaking EPA Michael Lopez: function sample plays Michael Lopez: R NFL analysis (presentation club staffers) Mitchell Wesson: QB hits investigation Mitchell Wesson: Investigation nflscrapR EP model WHoffman: graphs receivers (aDoT, success rate, ) ChiBearsStats: investigation 3rd downs vs offensive efficiency ChiBearsStats: insignificance field goal kicking","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"more-data-sources","dir":"Articles","previous_headings":"Next Steps","what":"More data sources","title":"A beginner's guide to nflfastR","text":"Lee Sharpe: Draft Picks, Draft Values, Games, Logos, Rosters, Standings greerre: get .csv file weather & stadium data PFR python Parker Fleming: Introduction College Football Data R cfbscrapR","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"other-code-examples-python","dir":"Articles","previous_headings":"Next Steps","what":"Other code examples: Python","title":"A beginner's guide to nflfastR","text":"Deryck97: nflfastR Python Guide Nick Wan: nflfastR Python Colab Guide Cory Jez: animated plot 903124S: Sampling EP 903124S: estimating EPA using nfldb 903124S: estimate EPA college football Blake Atkinson: explosiveness blog post python code Blake Atkinson: player type visualizations blog post python code","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"the-main-functions","dir":"Articles","previous_headings":"","what":"The Main Functions","title":"Get started with nflfastR","text":"nflfastR comes set functions access NFL play--play data team rosters. section provides brief introduction essential functions. nflfastR processes cleans play--play data adds variables ’s models. Since tasks performed separate functions, easiest way compute complete nflfastR dataset build_nflfastR_pbp(). main input function set game ids can accessed fast_scraper_schedules(). following code demonstrates build nflfastR dataset Super Bowls 2017 - 2019 seasons. cases, however, necessary use function individual games, nflfastR provides data repository two main play--play functions: load_pbp() update_db(). cover load_pbp() , please see Example 8: Using built-database function work database function update_db(). easiest way access data data repository new function load_pbp(). can load multiple seasons directly memory supports multiple data formats. Loading play--play data 2018-2020 seasons easy Joining roster data play--play data set possible well. data can accessed function fast_scraper_roster() application demonstrated Example 10: Working roster position data.","code":"library(nflfastR) library(dplyr, warn.conflicts = FALSE) ids <- nflfastR::fast_scraper_schedules(2017:2019) %>% dplyr::filter(game_type == \"SB\") %>% dplyr::pull(game_id) pbp <- nflfastR::build_nflfastR_pbp(ids) #> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.6.1.9007 ── #> • 10:56:04 | Start download of 3 games... #> ✔ 10:56:10 | Download finished. Adding variables... #> ✔ 10:56:10 | added game variables #> ✔ 10:56:10 | added nflscrapR variables #> [10:56:10] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> ✔ 10:56:11 | added ep variables #> ✔ 10:56:11 | added air_yac_ep variables #> [10:56:11] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> [10:56:11] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> ✔ 10:56:11 | added wp variables #> ✔ 10:56:11 | added air_yac_wp variables #> [10:56:11] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> ✔ 10:56:11 | added cp and cpoe #> ✔ 10:56:11 | added fixed drive variables #> ✔ 10:56:11 | added series variables #> • 10:56:11 | Cleaning up play-by-play... #> ✔ 10:56:12 | Cleaning completed #> ✔ 10:56:12 | added qb_epa #> • 10:56:12 | Computing xyac... #> [10:56:13] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> ✔ 10:56:14 | added xyac variables #> • 10:56:14 | Computing xpass... #> [10:56:14] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> ✔ 10:56:14 | added xpass and pass_oe #> • 10:56:14 | Decode player ids... #> ✔ 10:56:15 | Decoding of player ids completed #> ── DONE ──────────────────────────────────────────────────────────────────────── pbp <- nflfastR::load_pbp(2018:2020)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"application-examples","dir":"Articles","previous_headings":"","what":"Application Examples","title":"Get started with nflfastR","text":"examples listed assume following two libraries installed loaded.","code":"library(nflfastR) library(tidyverse)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-1-replicate-nflscrapr-with-fast_scraper","dir":"Articles","previous_headings":"Application Examples","what":"Example 1: replicate nflscrapR with fast_scraper","title":"Get started with nflfastR","text":"functionality nflscrapR can duplicated using fast_scraper(). obtains information contained nflscrapR (plus extra) much quickly. compare nflscrapR, use data repository program longer functions now NFL taken old Gamecenter feed. Note EP differs nflscrapR use newer era-adjusted model (post Open Source Football). example also uses built-function clean_pbp() create ‘name’ column primary player involved (QB pass play ball-carrier run play).","code":"readr::read_csv(\"https://github.com/ryurko/nflscrapR-data/blob/master/play_by_play_data/regular_season/reg_pbp_2019.csv?raw=true\") %>% dplyr::filter(home_team == \"SF\" & away_team == \"SEA\") %>% dplyr::select(desc, play_type, ep, epa, home_wp) %>% utils::head(6) %>% knitr::kable(digits = 3) nflfastR::fast_scraper(\"2019_10_SEA_SF\") %>% nflfastR::clean_pbp() %>% dplyr::select(desc, play_type, ep, epa, home_wp, name) %>% utils::head(6) %>% knitr::kable(digits = 3)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-2-scrape-a-batch-of-games-very-quickly-with-fast_scraper","dir":"Articles","previous_headings":"Application Examples","what":"Example 2: scrape a batch of games very quickly with fast_scraper","title":"Get started with nflfastR","text":"demonstration nflfastR’s capabilities. nflfastR can scrape batch games quickly, please respectful Github’s servers use data repository hosts scraped cleaned data whenever possible. reason ever actually use scraper ’s middle season haven’t updated repository recent games (automatically updated overnight every day).","code":"# get list of some games from 2019 games_2019 <- nflfastR::fast_scraper_schedules(2019) %>% utils::head(10) %>% dplyr::pull(game_id) tictoc::tic(glue::glue(\"{length(games_2019)} games with nflfastR:\")) f <- nflfastR::fast_scraper(games_2019) tictoc::toc() #> 10 games with nflfastR:: 7.806 sec elapsed"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-3-completion-percentage-over-expected-cpoe","dir":"Articles","previous_headings":"Application Examples","what":"Example 3: Completion Percentage Over Expected (CPOE)","title":"Get started with nflfastR","text":"Let’s look CPOE leaders 2009 regular season. discussed , nflfastR data repository old seasons, ’s need actually scrape . Let’s use convenience function load_pbp() fetches data repository (non-R users, .csv .parquet also available data repository).","code":"tictoc::tic(\"loading all games from 2009\") games_2009 <- nflfastR::load_pbp(2009) %>% dplyr::filter(season_type == \"REG\") tictoc::toc() #> loading all games from 2009: 1.888 sec elapsed games_2009 %>% dplyr::filter(!is.na(cpoe)) %>% dplyr::group_by(passer_player_name) %>% dplyr::summarize(cpoe = mean(cpoe), Atts = n()) %>% dplyr::filter(Atts > 200) %>% dplyr::arrange(-cpoe) %>% utils::head(5) %>% knitr::kable(digits = 1)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-4-using-drive-information","dir":"Articles","previous_headings":"Application Examples","what":"Example 4: Using Drive Information","title":"Get started with nflfastR","text":"working nflfastR, drive results automatically included. use fixed_drive fixed_drive_result since NFL-provided information bit wonky. Let’s look much likely teams score starting 1st & 10 20 yard line 2015 (last year touchbacks kickoffs changed 25) 2000. 20.6% 1st & 10 plays teams’ 20 see drive end score 2003, compared 30.5% 2015. implications Expected Points models (see article).","code":"pbp <- nflfastR::load_pbp(c(2003, 2015)) out <- pbp %>% dplyr::filter(season_type == \"REG\" & down == 1 & ydstogo == 10 & yardline_100 == 80) %>% dplyr::mutate(drive_score = dplyr::if_else(fixed_drive_result %in% c(\"Touchdown\", \"Field goal\"), 1, 0)) %>% dplyr::group_by(season) %>% dplyr::summarize(drive_score = mean(drive_score)) out %>% knitr::kable(digits = 3)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-5-plot-offensive-and-defensive-epa-per-play-for-a-given-season","dir":"Articles","previous_headings":"Application Examples","what":"Example 5: Plot offensive and defensive EPA per play for a given season","title":"Get started with nflfastR","text":"Let’s build NFL team tiers using offensive defensive expected points added per play 2005 regular season. Creating data viz including NFL team logos (wordmarks, headshots), recommend nflverse R package nflplotR. using load_pbp(), helper function clean_pbp() already run, creates “rush” “pass” columns () properly count sacks scrambles pass plays (b) properly include plays penalties. Using , can keep rush pass plays.","code":"library(nflplotR) pbp <- nflfastR::load_pbp(2005) %>% dplyr::filter(season_type == \"REG\") %>% dplyr::filter(!is.na(posteam) & (rush == 1 | pass == 1)) offense <- pbp %>% dplyr::group_by(team = posteam) %>% dplyr::summarise(off_epa = mean(epa, na.rm = TRUE)) defense <- pbp %>% dplyr::group_by(team = defteam) %>% dplyr::summarise(def_epa = mean(epa, na.rm = TRUE)) offense %>% dplyr::inner_join(defense, by = \"team\") %>% ggplot2::ggplot(aes(x = off_epa, y = def_epa)) + ggplot2::geom_abline(slope = -1.5, intercept = c(.4, .3, .2, .1, 0, -.1, -.2, -.3), alpha = .2) + nflplotR::geom_mean_lines(aes(y0 = off_epa, x0 = def_epa)) + nflplotR::geom_nfl_logos(aes(team_abbr = team), width = 0.07, alpha = 0.7) + ggplot2::labs( x = \"Offense EPA/play\", y = \"Defense EPA/play\", caption = \"Data: @nflfastR\", title = \"2005 NFL Offensive and Defensive EPA per Play\" ) + ggplot2::theme_bw() + ggplot2::theme( plot.title = ggplot2::element_text(size = 12, hjust = 0.5, face = \"bold\") ) + ggplot2::scale_y_reverse()"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-6-expected-points-calculator","dir":"Articles","previous_headings":"Application Examples","what":"Example 6: Expected Points calculator","title":"Get started with nflfastR","text":"provided calculator working Expected Points model. example use , looking Expected Points drive beginning following touchback changed time. put 'SEA' home_team posteam, matters figuring whether team ball home team (’s actual effect given team; matter team supplied). surprisingly, offenses become much successful time, kickoff touchback moving 20 25 2016 providing additional boost. Note td_prob example probability next score within half touchdown scored team ball, probability current drive end touchdown (numbers different Example 4 ). compare recent four years expectation playing dome inputting things changing roof input: 2018 2019, 1st & 10 home team’s 25 yard line higher EP domes home, expected.","code":"data <- tibble::tibble( \"season\" = 1999:2019, \"home_team\" = \"SEA\", \"posteam\" = \"SEA\", \"roof\" = \"outdoors\", \"half_seconds_remaining\" = 1800, \"yardline_100\" = c(rep(80, 17), rep(75, 4)), \"down\" = 1, \"ydstogo\" = 10, \"posteam_timeouts_remaining\" = 3, \"defteam_timeouts_remaining\" = 3 ) nflfastR::calculate_expected_points(data) %>% dplyr::select(season, yardline_100, td_prob, ep) %>% knitr::kable(digits = 2) data <- tibble::tibble( \"season\" = 2016:2019, \"week\" = 5, \"home_team\" = \"SEA\", \"posteam\" = \"SEA\", \"roof\" = \"dome\", \"half_seconds_remaining\" = 1800, \"yardline_100\" = c(rep(75, 4)), \"down\" = 1, \"ydstogo\" = 10, \"posteam_timeouts_remaining\" = 3, \"defteam_timeouts_remaining\" = 3 ) nflfastR::calculate_expected_points(data) %>% dplyr::select(season, yardline_100, td_prob, ep) %>% knitr::kable(digits = 2)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-7-win-probability-calculator","dir":"Articles","previous_headings":"Application Examples","what":"Example 7: Win probability calculator","title":"Get started with nflfastR","text":"also provided calculator working win probability models. example use , looking win probability begin game depends pre-game spread. put 'SEA' home_team posteam, matters figuring whether team ball home team (’s actual effect given team; matter team supplied). surprisingly, vegas_wp increases amount team coming game favored .","code":"data <- tibble::tibble( \"receive_2h_ko\" = 0, \"home_team\" = \"SEA\", \"posteam\" = \"SEA\", \"score_differential\" = 0, \"half_seconds_remaining\" = 1800, \"game_seconds_remaining\" = 3600, \"spread_line\" = c(1, 3, 4, 7, 14), \"down\" = 1, \"ydstogo\" = 10, \"yardline_100\" = 75, \"posteam_timeouts_remaining\" = 3, \"defteam_timeouts_remaining\" = 3 ) nflfastR::calculate_win_probability(data) %>% dplyr::select(spread_line, wp, vegas_wp) %>% knitr::kable(digits = 2)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-8-using-the-built-in-database-function","dir":"Articles","previous_headings":"Application Examples","what":"Example 8: Using the built-in database function","title":"Get started with nflfastR","text":"’re comfortable using dplyr functions manipulate tidy data, ’re ready use database. use database? provided function nflfastR makes extremely easy build database keep updated Play--play data 20+ seasons takes lot memory: working database allows bring memory actually need R makes extremely easy work databases.","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"start-install-and-load-packages","dir":"Articles","previous_headings":"Application Examples > Example 8: Using the built-in database function","what":"Start: install and load packages","title":"Get started with nflfastR","text":"start, need install two packages required aren’t installed automatically nflfastR installs: DBI RSQLite (advanced users can use types databases, example use SQLite). statements make sure packages won’t updated already installed: always, need install . don’t need loaded build database nflfastR knows use , need later working database.","code":"if (!require(\"DBI\")) install.packages(\"DBI\") if (!require(\"RSQLite\")) install.packages(\"RSQLite\") library(DBI) library(RSQLite)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"build-database","dir":"Articles","previous_headings":"Application Examples > Example 8: Using the built-in database function","what":"Build database","title":"Get started with nflfastR","text":"’s exactly one function nflfastR works databases: update_db(). notes: use update_db() arguments, build SQLite database called pbp_db current working directory, play--play data table called nflfastR_pbp. can specify different directory dbdir. can specify different filename dbname. can specify different table name tblname. want rebuild database scratch whatever reason, supply force_rebuild = TRUE. primarily intended case update play--play data data repo due fixing bug want force database wiped updated. want rebuild specified seasons, can also supplied force_rebuild (e.g. force_rebuild = c(2019, 2020)). parameter db_connection intended advanced users want use DBI drivers, MariaDB, Postgres odbc. Please note dbdir dbname dropped db_connection provided argument tblname still used write data table database. Let’s say just want dump database current working directory. go! created database current directory called pbp_db. Wait, ’s ? ’s ! ’s partway season want make sure new games added database? run? update_db()! (just make sure ’re directory database saved supply right file path) ’s partway season want re-build season allow data corrections NFL propagate database, can specify one season rebuilt:","code":"nflfastR::update_db() #> ── Update nflfastR Play-by-Play Database ──────── nflfastR version 4.6.1.9007 ── #> ℹ 10:56:56 | Can't find the data table \"nflfastR_pbp\" #> in your database. Will load the play by play data from #> scratch. #> • 10:56:56 | Starting download of 25 seasons between 1999 and 2023... #> • 10:58:10 | Checking for missing completed games... #> ℹ 10:58:12 | You have 6703 games and are missing 0. #> ✔ 10:58:12 | Database update completed #> ℹ 10:58:12 | Path to your db: ./pbp_db #> ── DONE ──────────────────────────────────────────────────────────────────────── nflfastR::update_db() #> ── Update nflfastR Play-by-Play Database ──────── nflfastR version 4.6.1.9007 ── #> • 10:58:12 | Checking for missing completed games... #> ℹ 10:58:13 | You have 6703 games and are missing 0. #> ✔ 10:58:13 | Database update completed #> ℹ 10:58:13 | Path to your db: /home/runner/work/nflfastR/nflfastR/vignettes/pbp_db #> ── DONE ──────────────────────────────────────────────────────────────────────── nflfastR::update_db(force_rebuild = 2020) #> ── Update nflfastR Play-by-Play Database ──────── nflfastR version 4.6.1.9007 ── #> • 10:58:13 | Purging season 2020 from the data table \"nflfastR_pbp\" in your #> connected database... #> • 10:58:14 | Starting download of the 1 season 2020 #> • 10:58:17 | Checking for missing completed games... #> ℹ 10:58:18 | You have 6703 games and are missing 0. #> ✔ 10:58:18 | Database update completed #> ℹ 10:58:18 | Path to your db: /home/runner/work/nflfastR/nflfastR/vignettes/pbp_db #> ── DONE ────────────────────────────────────────────────────────────────────────"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"connect-to-database","dir":"Articles","previous_headings":"Application Examples > Example 8: Using the built-in database function","what":"Connect to database","title":"Get started with nflfastR","text":"Now can make connection database. part look little bit foreign, need know database located. ’s current working directory, work: looks like nothing happened, now connection database. Now ’re ready stuff. aren’t familiar databases, ’re organized around tables. ’s see tables present database: Since went defaults, ’s table called nflfastR_pbp. Another useful function see fields (.e., columns) table: list list columns nflfastR play--play. Notice supply name table (\"nflfastR_pbp\"). way, ’s couple things learn. main driver tbl, helps get output specific table database: now, everything magically just “work”: can forget ’re even working database! far, everything stayed database. want bring query memory, just use collect() end: ’ve searched 1 million rows data across 300+ columns brought 6950 rows two columns memory. Pretty neat! supply data shiny apps rbsdm.com without running memory server. Now ’s one thing remember. ’re finished need database: details using database nflfastR, see Thomas Mock’s life-changing post . detailed information dbplyr (dplyr database back-end) given second edition Hadley Wickham’s R Data Science (2e).","code":"connection <- DBI::dbConnect(RSQLite::SQLite(), \"./pbp_db\") connection #> #> Path: /home/runner/work/nflfastR/nflfastR/vignettes/pbp_db #> Extensions: TRUE DBI::dbListTables(connection) #> [1] \"nflfastR_pbp\" DBI::dbListFields(connection, \"nflfastR_pbp\") %>% utils::head(10) #> [1] \"play_id\" \"game_id\" \"old_game_id\" \"home_team\" \"away_team\" #> [6] \"season_type\" \"week\" \"posteam\" \"posteam_type\" \"defteam\" pbp_db <- dplyr::tbl(connection, \"nflfastR_pbp\") pbp_db %>% dplyr::group_by(season) %>% dplyr::summarize(n = dplyr::n()) #> # Source: SQL [?? x 2] #> # Database: sqlite 3.45.0 [/home/runner/work/nflfastR/nflfastR/vignettes/pbp_db] #> season n #> #> 1 1999 46136 #> 2 2000 45491 #> 3 2001 44969 #> 4 2002 47355 #> 5 2003 46810 #> 6 2004 46706 #> 7 2005 46823 #> 8 2006 46299 #> 9 2007 46266 #> 10 2008 45917 #> # ℹ more rows pbp_db %>% dplyr::filter(rush == 1 | pass == 1, down <= 2, !is.na(epa), !is.na(posteam)) %>% dplyr::group_by(pass) %>% dplyr::summarize(mean_epa = mean(epa, na.rm = TRUE)) #> # Source: SQL [2 x 2] #> # Database: sqlite 3.45.0 [/home/runner/work/nflfastR/nflfastR/vignettes/pbp_db] #> pass mean_epa #> #> 1 0 -0.0977 #> 2 1 0.0733 russ <- pbp_db %>% dplyr::filter(name == \"R.Wilson\" & posteam == \"SEA\") %>% dplyr::select(desc, epa) %>% dplyr::collect() russ #> # A tibble: 6,946 × 2 #> desc epa #> #> 1 (14:12) 3-R.Wilson pass short right to 18-S.Rice to SEA 34 for 9 yar… 1.13 #> 2 (12:53) 3-R.Wilson pass incomplete deep left to 18-S.Rice. PENALTY o… 2.68 #> 3 (11:25) (Shotgun) 3-R.Wilson pass incomplete short right to 18-S.Ric… -1.31 #> 4 (10:24) (Shotgun) 3-R.Wilson pass short left to 18-S.Rice to ARI 31 … 0.928 #> 5 (9:47) 3-R.Wilson scrambles right end ran ob at ARI 27 for 4 yards (… -0.0194 #> 6 (8:35) 3-R.Wilson pass incomplete short right to 18-S.Rice. -0.426 #> 7 (7:54) (Shotgun) 3-R.Wilson left end pushed ob at ARI 9 for 4 yards … -1.17 #> 8 (:27) 3-R.Wilson sacked at SEA 17 for -5 yards (51-P.Lenon). Penalty… -1.13 #> 9 (14:28) (Shotgun) 3-R.Wilson pass short right to 17-B.Edwards to SEA… 1.94 #> 10 (13:59) 3-R.Wilson pass incomplete deep left to 87-B.Obomanu. -0.453 #> # ℹ 6,936 more rows DBI::dbDisconnect(connection)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-9-working-with-the-expected-yards-after-catch-model","dir":"Articles","previous_headings":"Application Examples","what":"Example 9: working with the expected yards after catch model","title":"Get started with nflfastR","text":"variables xyac follows: xyac_epa: expected value EPA gained catch, starting catch made. xyac_success: probability play earns positive EPA (relative play started) based ball caught. xyac_fd: Probability play earns first based ball caught. xyac_mean_yardage xyac_median_yardage: Average median expected yards catch based ball caught. notes: epa = air_epa + yac_epa, air_epa EPA associated catch target location. receiver loses fumble, removed yac_epa Expected value EPA catch point = air_epa + xyac_epa want get YAC EPA expected, need compare yac_epa xyac_epa, example get first downs expected, compare first_down xyac_fd fields populated pass attempts, whether caught , restrict completed passes measuring, example, YAC EPA expected expected YAC EPA model doesn’t take receiver fumbles account, actual minus expected YAC slightly negative due fumbles happening Let’s create measures EPA first downs expected 2015: presence many running backs list suggests even though takes account target depth pass direction, model doesn’t great job capturing space. Alternatively, running backs might better generating yards catch since running football primary role.","code":"nflfastR::load_pbp(2015) %>% dplyr::group_by(receiver, receiver_id, posteam) %>% dplyr::mutate(tgt = sum(complete_pass + incomplete_pass)) %>% dplyr::filter(tgt >= 50) %>% dplyr::filter(complete_pass == 1, air_yards < yardline_100, !is.na(xyac_epa)) %>% dplyr::summarize( epa_oe = mean(yac_epa - xyac_epa), actual_fd = mean(first_down), expected_fd = mean(xyac_fd), fd_oe = mean(first_down - xyac_fd), rec = dplyr::n() ) %>% dplyr::ungroup() %>% dplyr::select(receiver, posteam, actual_fd, expected_fd, fd_oe, epa_oe, rec) %>% dplyr::arrange(-epa_oe) %>% utils::head(10) %>% knitr::kable(digits = 3)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-10-working-with-roster-and-position-data","dir":"Articles","previous_headings":"Application Examples","what":"Example 10: Working with roster and position data","title":"Get started with nflfastR","text":"long last, ’s way merge new play--play data roster information. Use function get rosters: Now let’s load play--play data 2019: player IDs look like nflfastR now automatically decodes IDs look like old format GSIS IDs: Now ’re ready join roster data using IDs: surprisingly, 5 top 5 WRs terms EPA added come ahead top RB. Note number targets won’t match official stats ’re including plays penalties.","code":"roster <- nflfastR::fast_scraper_roster(2019) games_2019 <- nflfastR::load_pbp(2019) games_2019 %>% dplyr::filter(rush == 1 | pass == 1, posteam == \"SEA\") %>% dplyr::select(name, id) #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 1,207 × 2 #> name id #> #> 1 C.Carson 00-0033594 #> 2 R.Wilson 00-0029263 #> 3 R.Wilson 00-0029263 #> 4 C.Carson 00-0033594 #> 5 R.Wilson 00-0029263 #> 6 C.Carson 00-0033594 #> 7 R.Wilson 00-0029263 #> 8 C.Carson 00-0033594 #> 9 R.Wilson 00-0029263 #> 10 R.Wilson 00-0029263 #> # ℹ 1,197 more rows joined <- games_2019 %>% dplyr::filter(!is.na(receiver_id)) %>% dplyr::select(posteam, season, desc, receiver, receiver_id, epa) %>% dplyr::left_join(roster, by = c(\"receiver_id\" = \"gsis_id\")) # the real work is done, this just makes a table and has it look nice joined %>% dplyr::filter(position %in% c(\"WR\", \"TE\", \"RB\")) %>% dplyr::group_by(receiver_id, receiver, position) %>% dplyr::summarize(tot_epa = sum(epa), n = n()) %>% dplyr::arrange(-tot_epa) %>% dplyr::ungroup() %>% dplyr::group_by(position) %>% dplyr::mutate(position_rank = 1:n()) %>% dplyr::filter(position_rank <= 5) %>% dplyr::rename(Pos_Rank = position_rank, Player = receiver, Pos = position, Tgt = n, EPA = tot_epa) %>% dplyr::select(Player, Pos, Pos_Rank, Tgt, EPA) %>% knitr::kable(digits = 0)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-11-replicating-official-stats","dir":"Articles","previous_headings":"Application Examples","what":"Example 11: Replicating official stats","title":"Get started with nflfastR","text":"columns like name, passer, fantasy etc nflfastR-created columns mimic “real” football: .e., excluding plays spikes, counting scrambles sacks pass plays, etc. ’re trying replicate official statistics – perhaps fantasy purposes – use *_player_name *_player_id columns.","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"leaderboards","dir":"Articles","previous_headings":"Application Examples > Example 11: Replicating official stats","what":"Leaderboards","title":"Get started with nflfastR","text":"Let’s try replicate page passing leaders. match official stats NFL.com (note filter season_type == \"REG\" since official stats count regular season games). Note ’re using passing_yards yards_gained equal passing yards plays laterals. works, ’ve also provided function : calculate_player_stats(). function takes nflfastR play--play dataframe input along one argument, weekly, defaults FALSE. weekly true, week--week dataframe returned (rather aggregate whole provided dataframe). Let’s replicate top 10 players passing yards: can rush attempts replicate NFL leaderboard: , matches exactly.","code":"nflfastR::load_pbp(2020) %>% dplyr::filter(season_type == \"REG\", complete_pass == 1 | incomplete_pass == 1 | interception == 1, !is.na(down)) %>% dplyr::group_by(passer_player_name, posteam) %>% dplyr::summarize( yards = sum(passing_yards, na.rm = T), tds = sum(touchdown == 1 & td_team == posteam), ints = sum(interception), att = dplyr::n() ) %>% dplyr::arrange(-yards) %>% utils::head(10) %>% knitr::kable(digits = 0) nflfastR::load_pbp(2020) %>% dplyr::filter(season_type == \"REG\") %>% nflfastR::calculate_player_stats() %>% dplyr::arrange(-passing_yards) %>% dplyr::select(player_name, recent_team, completions, attempts, passing_yards, passing_tds, interceptions) %>% utils::head(10) %>% knitr::kable(digits = 0) nflfastR::load_pbp(2020) %>% dplyr::filter(season_type == \"REG\") %>% nflfastR::calculate_player_stats() %>% dplyr::arrange(-rushing_yards) %>% dplyr::select(player_name, recent_team, carries, rushing_yards, rushing_tds, rushing_fumbles_lost) %>% utils::head(10) %>% knitr::kable(digits = 0)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"yards-from-scrimmage","dir":"Articles","previous_headings":"Application Examples > Example 11: Replicating official stats","what":"Yards from scrimmage","title":"Get started with nflfastR","text":"want total yards scrimmage? ’ll demonstrate three methods . hardest way use fantasy_player_name column, rusher rush plays receiver receiving plays: Looking PFR scrimmage stats, columns exact match. also just use calculate_player_stats() : get thing. third way use load_player_stats() function, can load data frame player-level stats every week since 1999. output identical.","code":"nflfastR::load_pbp(2020) %>% dplyr::filter(season_type == \"REG\", !is.na(down)) %>% dplyr::group_by(fantasy_player_name, posteam) %>% dplyr::summarize( carries = sum(rush_attempt), receptions = sum(complete_pass), touches = sum(rush_attempt + complete_pass), yards = sum(yards_gained), tds = sum(touchdown == 1 & td_team == posteam) ) %>% dplyr::arrange(-yards) %>% utils::head(10) %>% knitr::kable(digits = 0) nflfastR::load_pbp(2020) %>% dplyr::filter(season_type == \"REG\") %>% nflfastR::calculate_player_stats() %>% dplyr::mutate( yards = rushing_yards + receiving_yards, touches = carries + receptions, tds = rushing_tds + receiving_tds ) %>% dplyr::arrange(-yards) %>% dplyr::select(player_name, recent_team, carries, receptions, touches, yards, tds) %>% utils::head(10) %>% knitr::kable(digits = 0) nflfastR::load_player_stats(seasons = 2020) %>% dplyr::filter(season_type == \"REG\") %>% dplyr::group_by(player_id) %>% dplyr::summarize( player_name = dplyr::first(player_name), recent_team = dplyr::first(recent_team), yards = sum(rushing_yards + receiving_yards), touches = sum(carries + receptions), carries = sum(carries), receptions = sum(receptions), tds = sum(rushing_tds + receiving_tds) ) %>% dplyr::ungroup() %>% dplyr::arrange(-yards) %>% dplyr::select(player_name, recent_team, carries, receptions, touches, yards, tds) %>% utils::head(10) %>% knitr::kable(digits = 0)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"fantasy-points","dir":"Articles","previous_headings":"Application Examples > Example 11: Replicating official stats","what":"Fantasy points","title":"Get started with nflfastR","text":"Let’s calculate PPR fantasy points per game first 16 weeks season among wide receivers appeared 5 games. Comparing FantasyPros website, exact match.","code":"nflfastR::load_pbp(2020) %>% dplyr::filter(week <= 16) %>% nflfastR::calculate_player_stats() %>% dplyr::mutate( ppg = fantasy_points_ppr / games ) %>% dplyr::filter(games > 5) %>% # only keep the WRs dplyr::inner_join( nflfastR::fast_scraper_roster(2020) %>% dplyr::filter(position == \"WR\") %>% dplyr::select(player_id = gsis_id), by = \"player_id\" ) %>% dplyr::arrange(-ppg) %>% dplyr::select(player_name, recent_team, games, fantasy_points_ppr, ppg) %>% utils::head(10) %>% knitr::kable(digits = 1)"},{"path":[]},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"the-drive-column-looks-wacky","dir":"Articles","previous_headings":"Frequent issues","what":"The drive column looks wacky","title":"Get started with nflfastR","text":"Use fixed_drive fixed_drive_result instead. See Example 4: Using Drive Information.","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"why-are-there-so-many-win-probability-columns","dir":"Articles","previous_headings":"Frequent issues","what":"Why are there so many win probability columns?","title":"Get started with nflfastR","text":"vegas_wp vegas_home_wp incorporate pregame spread much better models.","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"im-trying-to-do-x--help","dir":"Articles","previous_headings":"Frequent issues","what":"I’m trying to do X. Help!","title":"Get started with nflfastR","text":"Please ask Discord channel.","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"links","dir":"Articles","previous_headings":"","what":"Links","title":"Get started with nflfastR","text":"section helper holds hyperlinks chapters. ’s workaround missing sections anchor bug pkgdown hopefully fixed pull request point future. Main Functions Example 1: replicate nflscrapR fast_scraper Example 2: scrape batch games quickly fast_scraper Example 3: Completion Percentage Expected (CPOE) Example 4: Using Drive Information Example 5: Plot offensive defensive EPA per play given season Example 6: Expected Points calculator Example 7: Win probability calculator Example 8: Using built-database function Example 9: working expected yards catch model Example 10: Working roster position data Example 11: Replicating official stats Frequent issues Links","code":""},{"path":"https://www.nflfastr.com/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Sebastian Carl. Author. Ben Baldwin. Maintainer, author. Lee Sharpe. Contributor. Maksim Horowitz. Contributor. Ron Yurko. Contributor. Samuel Ventura. Contributor. Tan Ho. Contributor. John Edwards. Contributor.","code":""},{"path":"https://www.nflfastr.com/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Carl S, Baldwin B (2024). nflfastR: Functions Efficiently Access NFL Play Play Data. R package version 4.6.1.9007, https://github.com/nflverse/nflfastR, https://www.nflfastr.com/.","code":"@Manual{, title = {nflfastR: Functions to Efficiently Access NFL Play by Play Data}, author = {Sebastian Carl and Ben Baldwin}, year = {2024}, note = {R package version 4.6.1.9007, https://github.com/nflverse/nflfastR}, url = {https://www.nflfastr.com/}, }"},{"path":"https://www.nflfastr.com/index.html","id":"nflfastr-","dir":"","previous_headings":"","what":"An R package to quickly obtain clean and tidy NFL play by play data","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"nflfastR set functions efficiently scrape NFL play--play data. nflfastR expands upon features nflscrapR: package contains NFL play--play data back 1999 suggested package name, obtains games much faster Includes completion probability (cp), completion percentage expected (cpoe), expected yards catch (xyac_epa xyac_mean_yardage) play--play going back 2006 Includes drive information, including drive starting position drive result Includes series information, including series number series success Hosts repository play--play data going back 1999 quick access Features models Expected Points, Win Probability, Completion Probability, Yards Catch (see section ) Includes function update_db() creates updates database owe debt gratitude original nflscrapR team, Maksim Horowitz, Ronald Yurko, Samuel Ventura, without whose contributions inspiration package exist.","code":""},{"path":"https://www.nflfastr.com/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"easiest way get nflfastR install CRAN : get bug fix use feature development version, can install development version nflfastR either GitHub : prebuilt development repo :","code":"install.packages(\"nflfastR\") if (!require(\"pak\")) install.packages(\"pak\") pak::pak(\"nflverse/nflfastR\") install.packages(\"nflfastR\", repos = c(\"https://nflverse.r-universe.dev\", getOption(\"repos\")))"},{"path":"https://www.nflfastr.com/index.html","id":"usage","dir":"","previous_headings":"","what":"Usage","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"provided application examples Getting Started article. However, require basic knowledge R. reason nflfastR beginner’s guide, recommend looking introduction nflfastR R. can find column names descriptions Field Descriptions article, accessing field_descriptions dataframe package.","code":""},{"path":"https://www.nflfastr.com/index.html","id":"data-access","dir":"","previous_headings":"","what":"Data access","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"Even though nflfastR fast, recommend downloading data using nflreadr package. data sets include play--play data complete seasons going back 1999 updated nightly season. files contain regular season postseason data, one can use game_type week figure games occurred postseason.","code":""},{"path":"https://www.nflfastr.com/index.html","id":"nflfastr-models","dir":"","previous_headings":"","what":"nflfastR models","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"nflfastR uses models Expected Points, Win Probability, Completion Probability, Expected Yards Catch. read models, please see post Open Source Football. detailed description motivation Expected Points models, highly recommend paper nflscrapR team located . visualization Expected Points model yardline. visualization Completion Probability model air yards pass direction. nflfastR includes two win probability models: one one without incorporating pre-game spread.","code":""},{"path":"https://www.nflfastr.com/index.html","id":"special-thanks","dir":"","previous_headings":"","what":"Special thanks","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"Nick Shoemaker finding making available JSON-formatted NFL play--play back 1999 (nflfastR uses source 1999 2000 previously also used 2001-2010) Lau Sze Yui developing scraping function access JSON-formatted NFL play--play beginning 2001 Aaron Schatz Football Outsiders providing charting data correctly mark scrambles 2005 season Lee Sharpe curating resource game information Timo Riske, Lau Sze Yui, Sean Clement, Daniel Houston many helpful discussions regarding development new nflfastR models Zach Feldman Josh Hermsmeyer many helpful discussions CPOE models well Peter Owen many helpful suggestions CP model Florian Schmitt logo design many users found reported bugs nflfastR 1.0 course, original nflscrapR team, Maksim Horowitz, Ronald Yurko, Samuel Ventura, whose work represented dramatic step forward state public NFL research","code":""},{"path":"https://www.nflfastr.com/reference/add_qb_epa.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute QB epa — add_qb_epa","title":"Compute QB epa — add_qb_epa","text":"Compute QB epa","code":""},{"path":"https://www.nflfastr.com/reference/add_qb_epa.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute QB epa — add_qb_epa","text":"","code":"add_qb_epa(pbp, ...)"},{"path":"https://www.nflfastr.com/reference/add_qb_epa.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute QB epa — add_qb_epa","text":"pbp Data frame play--play data scraped using fast_scraper(). ... Additional arguments passed message function (internal use).","code":""},{"path":"https://www.nflfastr.com/reference/add_qb_epa.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute QB epa — add_qb_epa","text":"Add variable 'qb_epa', gives QB credit EPA point receiver lost fumble completed catch makes EPA work like passing yards plays fumbles","code":""},{"path":"https://www.nflfastr.com/reference/add_xpass.html","id":null,"dir":"Reference","previous_headings":"","what":"Add expected pass columns — add_xpass","title":"Add expected pass columns — add_xpass","text":"Build columns expected dropback model. return NA data prior 2006 since NFL started marking scrambles. Must run dataframe already clean_pbp() run . Note functions build_nflfastR_pbp() database function update_db() already include function.","code":""},{"path":"https://www.nflfastr.com/reference/add_xpass.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add expected pass columns — add_xpass","text":"","code":"add_xpass(pbp, ...)"},{"path":"https://www.nflfastr.com/reference/add_xpass.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add expected pass columns — add_xpass","text":"pbp Data frame play--play data scraped using fast_scraper(). ... Additional arguments passed message function (internal use).","code":""},{"path":"https://www.nflfastr.com/reference/add_xpass.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add expected pass columns — add_xpass","text":"input Data Frame parameter pbp following columns added: xpass Probability dropback scaled 0 1. pass_oe Dropback percent expected given play scaled 0 100.","code":""},{"path":"https://www.nflfastr.com/reference/add_xyac.html","id":null,"dir":"Reference","previous_headings":"","what":"Add expected yards after completion (xyac) variables — add_xyac","title":"Add expected yards after completion (xyac) variables — add_xyac","text":"Add expected yards completion (xyac) variables","code":""},{"path":"https://www.nflfastr.com/reference/add_xyac.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add expected yards after completion (xyac) variables — add_xyac","text":"","code":"add_xyac(pbp, ...)"},{"path":"https://www.nflfastr.com/reference/add_xyac.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add expected yards after completion (xyac) variables — add_xyac","text":"pbp Data frame play--play data scraped using fast_scraper(). ... Additional arguments passed message function (internal use).","code":""},{"path":"https://www.nflfastr.com/reference/add_xyac.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add expected yards after completion (xyac) variables — add_xyac","text":"input Data Frame parameter 'pbp' following columns added: xyac_epa Expected value EPA gained catch, starting catch made. Zero yards catch listed zero EPA. xyac_success Probability play earns positive EPA (relative play started) based ball caught. xyac_fd Probability play earns first based ball caught. xyac_mean_yardage Average expected yards catch based ball caught. xyac_median_yardage Median expected yards catch based ball caught.","code":""},{"path":"https://www.nflfastr.com/reference/add_xyac.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add expected yards after completion (xyac) variables — add_xyac","text":"Build columns capture expect catch.","code":""},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":null,"dir":"Reference","previous_headings":"","what":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"build_nflfastR_pbp convenient wrapper around 6 nflfastR functions: fast_scraper() clean_pbp() add_qb_epa() add_xyac() add_xpass() decode_player_ids() Please see either documentation function nflfastR Field Descriptions website learn output.","code":""},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"","code":"build_nflfastR_pbp( game_ids, dir = getOption(\"nflfastR.raw_directory\", default = NULL), ..., decode = TRUE, rules = TRUE )"},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"game_ids Vector character ids data frame including variable game_id (see details information). dir Path local directory (defaults option \"nflfastR.raw_directory\") nflfastR searches raw game play--play data. See save_raw_pbp() additional information. ... Additional arguments passed scraping functions (internal use) decode TRUE, function decode_player_ids() executed. rules FALSE, printing header footer console output suppressed.","code":""},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"nflfastR play--play data frame like can loaded https://github.com/nflverse/nflverse-data.","code":""},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"load valid game_ids please use package function fast_scraper_schedules().","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"","code":"# \\donttest{ # Build nflfastR pbp for the 2018 and 2019 Super Bowls try({# to avoid CRAN test problems build_nflfastR_pbp(c(\"2018_21_NE_LA\", \"2019_21_SF_KC\")) }) #> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.6.1.9007 ── #> • 10:52:57 | Start download of 2 games... #> ℹ It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan(\"multisession\")`! Will go on sequentially... #> ✔ 10:52:58 | Download finished. Adding variables... #> ✔ 10:52:59 | added game variables #> ✔ 10:52:59 | added nflscrapR variables #> [10:52:59] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> ✔ 10:53:00 | added ep variables #> ✔ 10:53:00 | added air_yac_ep variables #> [10:53:00] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> [10:53:00] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> ✔ 10:53:00 | added wp variables #> ✔ 10:53:00 | added air_yac_wp variables #> [10:53:00] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> ✔ 10:53:00 | added cp and cpoe #> ✔ 10:53:00 | added fixed drive variables #> ✔ 10:53:00 | added series variables #> • 10:53:00 | Cleaning up play-by-play... #> ✔ 10:53:00 | Cleaning completed #> ✔ 10:53:01 | added qb_epa #> • 10:53:01 | Computing xyac... #> [10:53:02] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> ✔ 10:53:03 | added xyac variables #> • 10:53:03 | Computing xpass... #> [10:53:03] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> ✔ 10:53:03 | added xpass and pass_oe #> • 10:53:03 | Decode player ids... #> ✔ 10:53:03 | Decoding of player ids completed #> ── DONE ──────────────────────────────────────────────────────────────────────── #> ── nflverse play by play ─────────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 10:53:03 UTC #> # A tibble: 349 × 372 #> play_id game_id old_game_id home_team away_team season_type week posteam #> #> 1 1 2018_21_NE… 2019020300 LA NE POST 21 NA #> 2 38 2018_21_NE… 2019020300 LA NE POST 21 NE #> 3 67 2018_21_NE… 2019020300 LA NE POST 21 NE #> 4 89 2018_21_NE… 2019020300 LA NE POST 21 NE #> 5 111 2018_21_NE… 2019020300 LA NE POST 21 NE #> 6 133 2018_21_NE… 2019020300 LA NE POST 21 NE #> 7 155 2018_21_NE… 2019020300 LA NE POST 21 NE #> 8 182 2018_21_NE… 2019020300 LA NE POST 21 LA #> 9 204 2018_21_NE… 2019020300 LA NE POST 21 LA #> 10 226 2018_21_NE… 2019020300 LA NE POST 21 LA #> # ℹ 339 more rows #> # ℹ 364 more variables: posteam_type , defteam , side_of_field , #> # yardline_100 , game_date , quarter_seconds_remaining , #> # half_seconds_remaining , game_seconds_remaining , #> # game_half , quarter_end , drive , sp , qtr , #> # down , goal_to_go , time , yrdln , ydstogo , #> # ydsnet , desc , play_type , yards_gained , … # It is also possible to directly use the # output of `fast_scraper_schedules` as input try({# to avoid CRAN test problems library(dplyr, warn.conflicts = FALSE) fast_scraper_schedules(2020) %>% slice_tail(n = 3) %>% build_nflfastR_pbp() }) #> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.6.1.9007 ── #> • 10:53:03 | Start download of 3 games... #> ℹ It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan(\"multisession\")`! Will go on sequentially... #> ✔ 10:53:06 | Download finished. Adding variables... #> ✔ 10:53:06 | added game variables #> ✔ 10:53:06 | added nflscrapR variables #> ✔ 10:53:06 | added ep variables #> ✔ 10:53:07 | added air_yac_ep variables #> ✔ 10:53:07 | added wp variables #> ✔ 10:53:07 | added air_yac_wp variables #> ✔ 10:53:07 | added cp and cpoe #> ✔ 10:53:07 | added fixed drive variables #> ✔ 10:53:07 | added series variables #> • 10:53:07 | Cleaning up play-by-play... #> ✔ 10:53:07 | Cleaning completed #> ✔ 10:53:07 | added qb_epa #> • 10:53:07 | Computing xyac... #> ✔ 10:53:08 | added xyac variables #> • 10:53:08 | Computing xpass... #> ✔ 10:53:08 | added xpass and pass_oe #> • 10:53:08 | Decode player ids... #> ✔ 10:53:09 | Decoding of player ids completed #> ── DONE ──────────────────────────────────────────────────────────────────────── #> ── nflverse play by play ─────────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 10:53:09 UTC #> # A tibble: 539 × 372 #> play_id game_id old_game_id home_team away_team season_type week posteam #> #> 1 1 2020_20_BU… 2021012401 KC BUF POST 20 NA #> 2 42 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 3 57 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 4 78 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 5 102 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 6 123 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 7 145 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 8 174 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 9 207 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 10 236 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> # ℹ 529 more rows #> # ℹ 364 more variables: posteam_type , defteam , side_of_field , #> # yardline_100 , game_date , quarter_seconds_remaining , #> # half_seconds_remaining , game_seconds_remaining , #> # game_half , quarter_end , drive , sp , qtr , #> # down , goal_to_go , time , yrdln , ydstogo , #> # ydsnet , desc , play_type , yards_gained , … # \\dontshow{ # Close open connections for R CMD Check future::plan(\"sequential\") # } # }"},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute expected points — calculate_expected_points","title":"Compute expected points — calculate_expected_points","text":"provided plays. Returns data probabilities scoring event EP added. following columns must present: season, home_team, posteam, roof (coded 'open', 'closed', 'retractable'), half_seconds_remaining, yardline_100, ydstogo, posteam_timeouts_remaining, defteam_timeouts_remaining","code":""},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute expected points — calculate_expected_points","text":"","code":"calculate_expected_points(pbp_data)"},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute expected points — calculate_expected_points","text":"pbp_data Play--play dataset estimate expected points .","code":""},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute expected points — calculate_expected_points","text":"original pbp_data following columns appended : ep expected points. no_score_prob probability scoring half. opp_fg_prob probability next score opponent field goal half. opp_safety_prob probability next score opponent safety half. opp_td_prob probability next score opponent touchdown half. fg_prob probability next score field goal half. safety_prob probability next score safety half. td_prob probability text score touchdown half.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute expected points — calculate_expected_points","text":"Computes expected points provided plays. Returns data probabilities scoring event EP added. following columns must present: season home_team posteam roof (coded 'outdoors', 'dome', 'open'/'closed'/NA (retractable)) half_seconds_remaining yardline_100 ydstogo posteam_timeouts_remaining defteam_timeouts_remaining","code":""},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute expected points — calculate_expected_points","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems library(dplyr) data <- tibble::tibble( \"season\" = 1999:2019, \"home_team\" = \"SEA\", \"posteam\" = \"SEA\", \"roof\" = \"outdoors\", \"half_seconds_remaining\" = 1800, \"yardline_100\" = c(rep(80, 17), rep(75, 4)), \"down\" = 1, \"ydstogo\" = 10, \"posteam_timeouts_remaining\" = 3, \"defteam_timeouts_remaining\" = 3 ) nflfastR::calculate_expected_points(data) %>% dplyr::select(season, yardline_100, td_prob, ep) }) #> season yardline_100 td_prob ep #> 1 1999 80 0.3342112 0.6378878 #> 2 2000 80 0.3342112 0.6378878 #> 3 2001 80 0.3342112 0.6378878 #> 4 2002 80 0.3431796 0.8167660 #> 5 2003 80 0.3431796 0.8167660 #> 6 2004 80 0.3431796 0.8167660 #> 7 2005 80 0.3431796 0.8167660 #> 8 2006 80 0.3445111 0.8136176 #> 9 2007 80 0.3445111 0.8136176 #> 10 2008 80 0.3445111 0.8136176 #> 11 2009 80 0.3445111 0.8136176 #> 12 2010 80 0.3445111 0.8136176 #> 13 2011 80 0.3445111 0.8136176 #> 14 2012 80 0.3445111 0.8136176 #> 15 2013 80 0.3445111 0.8136176 #> 16 2014 80 0.3522740 0.9822985 #> 17 2015 80 0.3522740 0.9822985 #> 18 2016 75 0.3771672 1.4573911 #> 19 2017 75 0.3771672 1.4573911 #> 20 2018 75 0.4067504 1.4740978 #> 21 2019 75 0.4067504 1.4740978 # }"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Get Official Game Stats — calculate_player_stats","title":"Get Official Game Stats — calculate_player_stats","text":"Build columns aggregate official passing, rushing, receiving stats either game level level entire data frame passed.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get Official Game Stats — calculate_player_stats","text":"","code":"calculate_player_stats(pbp, weekly = FALSE)"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get Official Game Stats — calculate_player_stats","text":"pbp Data frame NFL play--play data typically loaded load_pbp() build_nflfastR_pbp(). data include variable qb_epa, function add_qb_epa() called add . weekly TRUE, returns week--week stats, otherwise, stats entire Data frame.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get Official Game Stats — calculate_player_stats","text":"data frame including following columns (ID columns decoded gsis ID format): player_id ID player. Use join sources. player_name Name player player_display_name Full name player position Position player position_group Position group player headshot_url URL player headshot image games number games player recorded passing, rushing receiving stats. recent_team recent team player appears pbp . season Season weekly TRUE week Week weekly TRUE season_type REG POST weekly TRUE opponent_team player's opponent team weekly TRUE completions number completed passes. attempts number pass attempts defined NFL. passing_yards Yards gained pass plays. passing_tds number passing touchdowns. interceptions number interceptions thrown. sacks Number times sacked. sack_yards Yards lost sack plays. sack_fumbles number sacks fumble. sack_fumbles_lost number sacks lost fumble. passing_air_yards Passing air yards (includes incomplete passes). passing_yards_after_catch Yards catch gained plays player passer (unofficial stat may differ slightly different sources). passing_first_downs First downs pass attempts. passing_epa Total expected points added pass attempts sacks. NOTE: uses variable qb_epa, gives QB credit EPA point receiver lost fumble completed catch makes EPA work like passing yards plays fumbles. passing_2pt_conversions Two-point conversion passes. pacr Passing Air Conversion Ratio. PACR = passing_yards / passing_air_yards dakota Adjusted EPA + CPOE composite based coefficients best predict adjusted EPA/play following year. carries number official rush attempts (incl. scrambles kneel downs). Rushes lateral reception count carry. rushing_yards Yards gained rushing ball (incl. scrambles kneel downs). Also includes yards gained obtaining lateral play started rushing attempt. rushing_tds number rushing touchdowns (incl. scrambles). Also includes touchdowns obtaining lateral play started rushing attempt. rushing_fumbles number rushes fumble. rushing_fumbles_lost number rushes lost fumble. rushing_first_downs First downs rush attempts (incl. scrambles). rushing_epa Expected points added rush attempts (incl. scrambles kneel downs). rushing_2pt_conversions Two-point conversion rushes receptions number pass receptions. Lateral receptions officially count reception. targets number pass plays player targeted receiver. receiving_yards Yards gained pass reception. Includes yards gained receiving lateral play started pass play. receiving_tds number touchdowns following pass reception. Also includes touchdowns receiving lateral play started pass play. receiving_air_yards Receiving air yards (incl. incomplete passes). receiving_yards_after_catch Yards catch gained plays player receiver (unofficial stat may differ slightly different sources). receiving_fumbles number fumbles pass reception. receiving_fumbles_lost number fumbles lost pass reception. receiving_2pt_conversions Two-point conversion receptions racr Receiver Air Conversion Ratio. RACR = receiving_yards / receiving_air_yards target_share share targets player targets team air_yards_share share receiving_air_yards player air_yards team wopr Weighted Opportunity Rating. WOPR = 1.5 × target_share + 0.7 × air_yards_share fantasy_points Standard fantasy points. fantasy_points_ppr PPR fantasy points.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/calculate_player_stats.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get Official Game Stats — calculate_player_stats","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems pbp <- nflfastR::load_pbp(2020) weekly <- calculate_player_stats(pbp, weekly = TRUE) dplyr::glimpse(weekly) overall <- calculate_player_stats(pbp, weekly = FALSE) dplyr::glimpse(overall) }) #> Rows: 5,447 #> Columns: 53 #> $ player_id \"00-0019596\", \"00-0019596\", \"00-0019596\", … #> $ player_name \"T.Brady\", \"T.Brady\", \"T.Brady\", \"T.Brady\"… #> $ player_display_name \"Tom Brady\", \"Tom Brady\", \"Tom Brady\", \"To… #> $ position \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", … #> $ position_group \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", … #> $ headshot_url \"https://static.www.nfl.com/image/private/… #> $ recent_team \"TB\", \"TB\", \"TB\", \"TB\", \"TB\", \"TB\", \"TB\", … #> $ season 2020, 2020, 2020, 2020, 2020, 2020, 2020, … #> $ week 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14,… #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", … #> $ opponent_team \"NO\", \"CAR\", \"DEN\", \"LAC\", \"CHI\", \"GB\", \"L… #> $ completions 23, 23, 25, 30, 25, 17, 33, 28, 22, 28, 26… #> $ attempts 36, 35, 38, 46, 41, 27, 45, 40, 38, 39, 48… #> $ passing_yards 239, 217, 297, 369, 253, 166, 369, 279, 20… #> $ passing_tds 2, 1, 3, 5, 1, 2, 4, 2, 0, 3, 2, 3, 2, 2, … #> $ interceptions 2, 1, 0, 1, 0, 0, 0, 0, 3, 0, 2, 2, 0, 0, … #> $ sacks 3, 0, 2, 0, 3, 0, 0, 2, 3, 1, 1, 1, 0, 3, … #> $ sack_yards 15, 0, 12, 0, 20, 0, 0, 16, 23, 7, 7, 3, 0… #> $ sack_fumbles 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ sack_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ passing_air_yards 292, 234, 311, 431, 383, 231, 399, 364, 36… #> $ passing_yards_after_catch 90, 110, 111, 109, 100, 72, 134, 94, 80, 1… #> $ passing_first_downs 10, 11, 12, 20, 11, 9, 22, 18, 10, 18, 14,… #> $ passing_epa -9.4968573, 0.5243797, 11.5597024, 12.6856… #> $ passing_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ pacr 0.8184932, 0.9273504, 0.9549839, 0.8561485… #> $ dakota 0.06893691, 0.07635570, 0.15510344, 0.2138… #> $ carries 3, 1, 5, 3, 3, 0, 1, 1, 0, 2, 0, 1, 3, 2, … #> $ rushing_yards 9, 0, 0, -3, 0, 0, 1, -1, 0, 2, 0, -1, -2,… #> $ rushing_tds 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, … #> $ rushing_fumbles 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ rushing_fumbles_lost 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ rushing_first_downs 2, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, … #> $ rushing_epa 1.5054478, -5.4885905, -3.8117261, -1.1660… #> $ rushing_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receptions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ targets 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_air_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_yards_after_catch 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_first_downs 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_epa NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ receiving_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ racr NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ target_share NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ air_yards_share NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ wopr NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ special_teams_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ fantasy_points 20.46, 8.68, 23.88, 32.46, 14.12, 14.64, 3… #> $ fantasy_points_ppr 20.46, 8.68, 23.88, 32.46, 14.12, 14.64, 3… #> Rows: 636 #> Columns: 50 #> $ player_id \"00-0019596\", \"00-0020531\", \"00-0022127\", … #> $ player_name \"T.Brady\", \"D.Brees\", \"J.Witten\", \"M.Schau… #> $ player_display_name \"Tom Brady\", \"Drew Brees\", \"Jason Witten\",… #> $ position \"QB\", \"QB\", \"TE\", \"QB\", \"P\", \"WR\", \"QB\", \"… #> $ position_group \"QB\", \"QB\", \"TE\", \"QB\", \"SPEC\", \"WR\", \"QB\"… #> $ headshot_url \"https://static.www.nfl.com/image/private/… #> $ games 20, 14, 10, 1, 1, 13, 16, 17, 8, 18, 15, 9… #> $ recent_team \"TB\", \"NO\", \"LV\", \"ATL\", \"ARI\", \"ARI\", \"PI… #> $ completions 482, 322, 0, 0, 1, 0, 446, 396, 168, 428, … #> $ attempts 748, 463, 0, 0, 1, 0, 676, 589, 252, 610, … #> $ passing_yards 5694, 3341, 0, 0, 26, 0, 4304, 4478, 1582,… #> $ passing_tds 50, 27, 0, 0, 0, 0, 37, 26, 6, 53, 0, 13, … #> $ interceptions 15, 9, 0, 0, 0, 0, 14, 11, 8, 6, 0, 8, 0, … #> $ sacks 27, 13, 0, 0, 0, 0, 13, 19, 22, 25, 0, 14,… #> $ sack_yards 180, 89, 0, 0, 0, 0, 118, 118, 139, 214, 0… #> $ sack_fumbles 2, 6, 0, 0, 0, 0, 2, 2, 1, 1, 0, 2, 0, 0, … #> $ sack_fumbles_lost 0, 2, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, … #> $ passing_air_yards 6900, 2723, 0, 0, 14, 0, 4785, 4235, 1286,… #> $ passing_yards_after_catch 2256, 1700, 0, 0, 12, 0, 2136, 2346, 949, … #> $ passing_first_downs 288, 169, 0, 0, 1, 0, 222, 217, 74, 250, 0… #> $ passing_epa 174.550932, 64.772986, NA, NA, 4.014011, N… #> $ passing_2pt_conversions 0, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0, 2, 0, 0, … #> $ pacr 0.8252174, 1.2269556, NA, NA, 1.8571429, N… #> $ dakota 0.16324949, 0.11352942, NA, NA, NA, NA, 0.… #> $ carries 43, 23, 0, 3, 0, 0, 26, 19, 10, 42, 187, 3… #> $ rushing_yards 3, 3, 0, -4, 0, 0, 11, -9, 3, 146, 653, 15… #> $ rushing_tds 4, 2, 0, 0, 0, 0, 0, 0, 0, 4, 2, 2, 0, 0, … #> $ rushing_fumbles 4, 1, 0, 0, 0, 0, 3, 0, 1, 3, 1, 0, 0, 0, … #> $ rushing_fumbles_lost 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, … #> $ rushing_first_downs 8, 7, 0, 0, 0, 0, 3, 0, 0, 16, 32, 12, 0, … #> $ rushing_epa -22.6205957, -8.2220291, NA, 0.0000000, NA… #> $ rushing_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, … #> $ receptions 0, 0, 13, 0, 0, 54, 0, 0, 0, 1, 16, 1, 13,… #> $ targets 0, 0, 17, 0, 0, 72, 0, 0, 0, 1, 19, 1, 20,… #> $ receiving_yards 0, 0, 69, 0, 0, 409, 0, 0, 0, -6, 89, 0, 1… #> $ receiving_tds 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 0, … #> $ receiving_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_air_yards 0, 0, 91, 0, 0, 432, 0, 0, 0, -4, 34, -4, … #> $ receiving_yards_after_catch 0, 0, 20, 0, 0, 185, 0, 0, 0, -2, 73, 4, 7… #> $ receiving_first_downs 0, 0, 8, 0, 0, 25, 0, 0, 0, 0, 3, 0, 7, 0,… #> $ receiving_epa NA, NA, 2.4071780, NA, NA, -1.7713509, NA,… #> $ receiving_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ racr NA, NA, 0.7582418, NA, NA, 0.9467593, NA, … #> $ target_share NA, NA, 0.05279503, NA, NA, 0.16071429, NA… #> $ air_yards_share NA, NA, 0.033641405, NA, NA, 0.117615029, … #> $ wopr NA, NA, 0.10274153, NA, NA, 0.32340195, NA… #> $ special_teams_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ fantasy_points 420.06, 231.94, 18.90, -0.40, 1.04, 46.90,… #> $ fantasy_points_ppr 420.06, 231.94, 31.90, -0.40, 1.04, 100.90… # }"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_def.html","id":null,"dir":"Reference","previous_headings":"","what":"Get Official Game Stats on Defense — calculate_player_stats_def","title":"Get Official Game Stats on Defense — calculate_player_stats_def","text":"Build columns aggregate official defense stats either game level level entire data frame passed.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_def.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get Official Game Stats on Defense — calculate_player_stats_def","text":"","code":"calculate_player_stats_def(pbp, weekly = FALSE)"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_def.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get Official Game Stats on Defense — calculate_player_stats_def","text":"pbp Data frame NFL play--play data typically loaded load_pbp() build_nflfastR_pbp(). data include variable qb_epa, function add_qb_epa() called add . weekly TRUE, returns week--week stats, otherwise, stats entire Data frame.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_def.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get Official Game Stats on Defense — calculate_player_stats_def","text":"data frame defensive player stats. See dictionary (# TODO)","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_def.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get Official Game Stats on Defense — calculate_player_stats_def","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems pbp <- nflfastR::load_pbp(2020) weekly <- calculate_player_stats_def(pbp, weekly = TRUE) dplyr::glimpse(weekly) overall <- calculate_player_stats_def(pbp, weekly = FALSE) dplyr::glimpse(overall) }) #> Rows: 9,275 #> Columns: 32 #> $ season 2020, 2020, 2020, 2020, 2020, 2020, 2020… #> $ week 3, 11, 3, 5, 11, 12, 15, 6, 10, 12, 15, … #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\"… #> $ player_id \"00-0022921\", \"00-0022924\", \"00-0023448\"… #> $ player_name \"L.Fitzgerald\", \"B.Roethlisberger\", \"T.D… #> $ player_display_name \"Larry Fitzgerald\", \"Ben Roethlisberger\"… #> $ position \"WR\", \"QB\", \"OLB\", \"OLB\", \"OLB\", \"OLB\", … #> $ position_group \"WR\", \"QB\", \"LB\", \"LB\", \"LB\", \"LB\", \"LB\"… #> $ headshot_url \"https://static.www.nfl.com/image/privat… #> $ team \"DET\", \"JAX\", \"WAS\", \"WAS\", \"WAS\", \"WAS\"… #> $ def_tackles 1, 1, 2, 0, 1, 2, 0, 1, 1, 3, 3, 3, 2, 2… #> $ def_tackles_solo 1, 1, 2, 0, 1, 2, 0, 1, 1, 3, 3, 3, 2, 2… #> $ def_tackles_with_assist 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_tackle_assists 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0… #> $ def_tackles_for_loss 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_tackles_for_loss_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumbles_forced 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_sacks 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_sack_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_qb_hits 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0… #> $ def_interceptions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_interception_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_pass_defended 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0… #> $ def_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_own 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_yards_own 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_opp 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_yards_opp 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_safety 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_penalty 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_penalty_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> Rows: 1,418 #> Columns: 30 #> $ player_id \"00-0022921\", \"00-0022924\", \"00-0023448\"… #> $ player_name \"L.Fitzgerald\", \"B.Roethlisberger\", \"T.D… #> $ player_display_name \"Larry Fitzgerald\", \"Ben Roethlisberger\"… #> $ games 1, 1, 5, 1, 5, 3, 7, 6, 1, 1, 13, 1, 5, … #> $ position \"WR\", \"QB\", \"OLB\", \"QB\", \"CB\", \"CB\", \"CB… #> $ position_group \"WR\", \"QB\", \"LB\", \"QB\", \"DB\", \"DB\", \"DB\"… #> $ headshot_url \"https://static.www.nfl.com/image/privat… #> $ team \"DET\", \"JAX\", \"WAS\", \"NYJ\", \"BAL\", \"ARI\"… #> $ def_tackles 1, 1, 5, 1, 12, 3, 25, 6, 1, 1, 19, 1, 8… #> $ def_tackles_solo 1, 1, 5, 1, 12, 2, 23, 6, 1, 1, 16, 1, 6… #> $ def_tackles_with_assist 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 3, 0, 2, 2… #> $ def_tackle_assists 0, 0, 1, 0, 4, 0, 4, 10, 0, 0, 13, 0, 6,… #> $ def_tackles_for_loss 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 2… #> $ def_tackles_for_loss_yards 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 4… #> $ def_fumbles_forced 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0… #> $ def_sacks 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, … #> $ def_sack_yards 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, … #> $ def_qb_hits 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 11, 0, 0, … #> $ def_interceptions 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0… #> $ def_interception_yards 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0… #> $ def_pass_defended 0, 0, 1, 0, 1, 1, 5, 0, 0, 0, 7, 0, 0, 0… #> $ def_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_own 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_yards_own 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_opp 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_yards_opp 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_safety 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_penalty 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 1, 1, 1… #> $ def_penalty_yards 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 25, 14, 1… # }"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_kicking.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize Kicking Stats — calculate_player_stats_kicking","title":"Summarize Kicking Stats — calculate_player_stats_kicking","text":"Build columns aggregate kicking stats game level.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_kicking.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize Kicking Stats — calculate_player_stats_kicking","text":"","code":"calculate_player_stats_kicking(pbp, weekly = FALSE)"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_kicking.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize Kicking Stats — calculate_player_stats_kicking","text":"pbp Data frame NFL play--play data typically loaded load_pbp() build_nflfastR_pbp(). weekly TRUE, returns week--week stats, otherwise, stats entire data frame argument pbp.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_kicking.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summarize Kicking Stats — calculate_player_stats_kicking","text":"dataframe kicking stats","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_kicking.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize Kicking Stats — calculate_player_stats_kicking","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems pbp <- nflreadr::load_pbp(2021) weekly <- calculate_player_stats_kicking(pbp, weekly = TRUE) dplyr::glimpse(weekly) overall <- calculate_player_stats_kicking(pbp, weekly = FALSE) dplyr::glimpse(overall) }) #> Rows: 561 #> Columns: 44 #> $ season 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 20… #> $ week 1, 2, 3, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19… #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"… #> $ player_id \"00-0023252\", \"00-0023252\", \"00-0023252\", \"00-0023… #> $ team \"SF\", \"SF\", \"SF\", \"SF\", \"SF\", \"SF\", \"SF\", \"SF\", \"S… #> $ player_name \"R.Gould\", \"R.Gould\", \"R.Gould\", \"R.Gould\", \"R.Gou… #> $ player_display_name \"Robbie Gould\", \"Robbie Gould\", \"Robbie Gould\", \"R… #> $ position \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", … #> $ position_group \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"S… #> $ headshot_url \"https://static.www.nfl.com/image/private/f_auto,q… #> $ fg_made 2, 1, NA, 1, 1, 3, 2, 1, 2, 1, 1, 3, 2, 3, 2, 1, 1… #> $ fg_att 3, 1, 0, 1, 1, 3, 3, 1, 3, 1, 1, 3, 2, 3, 2, 1, 2,… #> $ fg_missed 1, 0, NA, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1… #> $ fg_blocked 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_long 52, 46, NA, 26, 50, 48, 46, 50, 33, 30, 48, 37, 42… #> $ fg_pct 0.667, 1.000, NA, 1.000, 1.000, 1.000, 0.667, 1.00… #> $ fg_made_0_19 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_made_20_29 0, 0, NA, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0… #> $ fg_made_30_39 0, 0, NA, 0, 0, 0, 0, 0, 1, 1, 0, 2, 0, 0, 0, 1, 1… #> $ fg_made_40_49 1, 1, NA, 0, 0, 2, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0… #> $ fg_made_50_59 1, 0, NA, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0… #> $ fg_made_60_ 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_missed_0_19 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_missed_20_29 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_missed_30_39 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_missed_40_49 0, 0, NA, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1… #> $ fg_missed_50_59 1, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_missed_60_ 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_made_list \"40;52\", \"46\", NA, \"26\", \"50\", \"20;48;45\", \"46;22\"… #> $ fg_missed_list \"52\", NA, NA, NA, NA, NA, \"42\", NA, \"47\", NA, NA, … #> $ fg_blocked_list NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ fg_made_distance 92, 46, NA, 26, 50, 113, 68, 50, 57, 30, 48, 100, … #> $ fg_missed_distance 52, 0, NA, 0, 0, 0, 42, 0, 47, 0, 0, 0, 0, 0, 0, 0… #> $ fg_blocked_distance 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ pat_made 5, 2, 4, 2, 4, 3, 4, 2, 2, 4, 2, 2, 3, 2, 1, 2, 5,… #> $ pat_att 5, 2, 4, 2, 4, 3, 4, 3, 2, 4, 2, 2, 3, 2, 1, 2, 5,… #> $ pat_missed 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ pat_blocked 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ pat_pct 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 0… #> $ gwfg_att 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0,… #> $ gwfg_distance NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 24… #> $ gwfg_made NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1,… #> $ gwfg_missed NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0,… #> $ gwfg_blocked NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0,… #> Rows: 58 #> Columns: 42 #> $ player_id \"00-0023252\", \"00-0023853\", \"00-0025565\", \"00-0025… #> $ team \"SF\", \"ARI\", \"NE\", \"GB\", \"NYG\", \"TB\", \"TEN\", \"BAL\"… #> $ player_name \"R.Gould\", \"M.Prater\", \"N.Folk\", \"M.Crosby\", \"G.Ga… #> $ player_display_name \"Robbie Gould\", \"Matt Prater\", \"Nick Folk\", \"Mason… #> $ games 16, 18, 18, 18, 17, 19, 17, 17, 16, 17, 11, 6, 7, … #> $ position \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", … #> $ position_group \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"S… #> $ headshot_url \"https://static.www.nfl.com/image/private/f_auto,q… #> $ fg_made 26, 31, 37, 26, 29, 28, 27, 35, 30, 26, 18, 12, 16… #> $ fg_att 29, 38, 40, 36, 33, 34, 32, 37, 36, 31, 20, 14, 18… #> $ fg_missed 3, 7, 3, 7, 4, 6, 5, 2, 6, 4, 2, 2, 2, NA, 4, 3, 6… #> $ fg_blocked 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, NA, 0, 1, 0… #> $ fg_long 53, 62, 53, 54, 55, 48, 51, 66, 56, 61, 50, 50, 42… #> $ fg_pct 0.897, 0.816, 0.925, 0.722, 0.879, 0.824, 0.844, 0… #> $ fg_made_0_19 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, NA, 0, 0, 0… #> $ fg_made_20_29 7, 11, 9, 9, 5, 11, 5, 7, 5, 7, 5, 3, 4, NA, 9, 10… #> $ fg_made_30_39 5, 9, 11, 10, 12, 9, 13, 9, 15, 6, 4, 2, 8, NA, 8,… #> $ fg_made_40_49 9, 3, 12, 4, 5, 8, 8, 13, 7, 8, 7, 6, 4, NA, 11, 1… #> $ fg_made_50_59 5, 7, 5, 3, 7, 0, 1, 5, 3, 4, 1, 1, 0, NA, 8, 0, 3… #> $ fg_made_60_ 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, NA, 0, 0, 0… #> $ fg_missed_0_19 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0… #> $ fg_missed_20_29 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0… #> $ fg_missed_30_39 0, 2, 0, 2, 1, 1, 0, 0, 1, 0, 0, 0, 1, NA, 1, 0, 2… #> $ fg_missed_40_49 2, 2, 0, 4, 0, 4, 5, 2, 2, 0, 0, 1, 0, NA, 2, 1, 2… #> $ fg_missed_50_59 1, 1, 3, 1, 3, 1, 0, 0, 2, 4, 2, 1, 1, NA, 1, 1, 2… #> $ fg_missed_60_ 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, NA, 0, 1, 0… #> $ fg_made_list \"40;52;46;26;50;20;48;45;46;22;50;33;24;30;48;37;2… #> $ fg_missed_list \"52;42;47\", \"43;68;61;39;36;51;41\", \"56;54;53\", \"3… #> $ fg_blocked_list NA, NA, NA, \"34;37;39\", NA, NA, NA, NA, NA, \"22\", … #> $ fg_made_distance 1003, 1158, 1399, 936, 1146, 931, 985, 1401, 1139,… #> $ fg_missed_distance 141, 339, 163, 283, 196, 273, 226, 97, 287, 212, 1… #> $ fg_blocked_distance 0, 0, 0, 110, 0, 0, 0, 0, 0, 22, 0, 0, 0, NA, 0, 4… #> $ pat_made 44, 47, 44, 50, 17, 63, 43, 32, 44, 33, 30, 10, 10… #> $ pat_att 45, 49, 49, 52, 17, 66, 46, 32, 50, 34, 32, 12, 12… #> $ pat_missed 1, 2, 4, 2, 0, 3, 3, 0, 6, 1, 2, 2, 2, 2, 2, 1, 3,… #> $ pat_blocked 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ pat_pct 0.978, 0.959, 0.898, 0.962, 1.000, 0.955, 0.935, 1… #> $ gwfg_att 2, 1, 2, 2, 2, 2, 3, 3, 1, 0, 1, 1, 0, 0, 3, 2, 0,… #> $ gwfg_distance_list \"24;45\", \"27\", \"56;21\", \"51;49\", \"35;27\", \"36;48\",… #> $ gwfg_made 2, 1, 1, 2, 2, 2, 3, 3, 1, NA, 1, 1, NA, NA, 3, 1,… #> $ gwfg_missed 0, 0, 1, 0, 0, 0, 0, 0, 0, NA, 0, 0, NA, NA, 0, 1,… #> $ gwfg_blocked 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, 0, 0, NA, NA, 0, 0,… # }"},{"path":"https://www.nflfastr.com/reference/calculate_series_conversion_rates.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","title":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","text":"\"Series\" begins 1st 10 team attempts either earn new 1st (offense) prevent offense converting new 1st (defense). Series conversion rate represents many series either converted new 1st ended touchdown. function computes series conversion rates offense defense nflverse play--play data along series results. function automatically removes series ended QB kneel .","code":""},{"path":"https://www.nflfastr.com/reference/calculate_series_conversion_rates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","text":"","code":"calculate_series_conversion_rates(pbp, weekly = FALSE)"},{"path":"https://www.nflfastr.com/reference/calculate_series_conversion_rates.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","text":"pbp Play--play data returned load_pbp(), build_nflfastR_pbp(), fast_scraper(). weekly TRUE, returns week--week stats, otherwise, season--season stats argument pbp.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_series_conversion_rates.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","text":"data frame series information including following columns: season NFL season team NFL team abbreviation week Week weekly TRUE off_n number series offense played (excludes QB kneel downs, kickoffs, extra point/two point conversion attempts, non-plays, plays list \"posteam\") off_scr rate series ended either new 1st touchdown offense field off_scr_1st rate offense earned 1st scored touchdown 1st off_scr_2nd rate offense earned 1st scored touchdown 2nd off_scr_3rd rate offense earned 1st scored touchdown 3rd off_scr_4th rate offense earned 1st scored touchdown 4th off_1st rate series ended new 1st offense field (include offensive touchdown) off_td rate series ended offensive touchdown offense field off_fg rate series ended field goal attempt offense field off_punt rate series ended punt offense field off_to rate series ended turnover (including downs), opponent score, end half (game) offense field def_n number series defense played (excludes QB kneel downs, kickoffs, extra point/two point conversion attempts, non-plays, plays list \"posteam\") def_scr rate series ended either new 1st touchdown defense field def_scr_1st rate defense allowed 1st touchdown 1st def_scr_2nd rate defense allowed 1st touchdown 2nd def_scr_3rd rate defense allowed 1st touchdown 3rd def_scr_4th rate defense allowed 1st touchdown 4th def_1st rate series ended new 1st defense field (include offensive touchdown) def_td rate series ended offensive touchdown defense field def_fg rate series ended field goal attempt defense field def_punt rate series ended punt defense field def_to rate series ended turnover (including downs), opponent score, end half (game) defense field","code":""},{"path":"https://www.nflfastr.com/reference/calculate_series_conversion_rates.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems pbp <- nflfastR::load_pbp(2021) weekly <- calculate_series_conversion_rates(pbp, weekly = TRUE) dplyr::glimpse(weekly) overall <- calculate_series_conversion_rates(pbp, weekly = FALSE) dplyr::glimpse(overall) }) #> Rows: 570 #> Columns: 25 #> $ season 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021… #> $ team \"ARI\", \"ARI\", \"ARI\", \"ARI\", \"ARI\", \"ARI\", \"ARI\", \"ARI\", \"A… #> $ week 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18,… #> $ off_n 28, 29, 31, 32, 27, 29, 31, 27, 28, 21, 36, 20, 31, 31, 27… #> $ off_scr 0.7857143, 0.7241379, 0.7419355, 0.8437500, 0.7407407, 0.8… #> $ off_scr_1st 0.1428571, 0.2413793, 0.1935484, 0.1250000, 0.1851852, 0.1… #> $ off_scr_2nd 0.3571429, 0.3448276, 0.4516129, 0.4375000, 0.4444444, 0.3… #> $ off_scr_3rd 0.28571429, 0.10344828, 0.03225806, 0.28125000, 0.11111111… #> $ off_scr_4th 0.00000000, 0.03448276, 0.06451613, 0.00000000, 0.00000000… #> $ off_1st 0.6071429, 0.5862069, 0.6451613, 0.7187500, 0.6666667, 0.6… #> $ off_td 0.17857143, 0.13793103, 0.09677419, 0.12500000, 0.07407407… #> $ off_fg 0.07142857, 0.06896552, 0.03225806, 0.09375000, 0.07407407… #> $ off_punt 0.10714286, 0.13793103, 0.16129032, 0.06250000, 0.14814815… #> $ off_to 0.03571429, 0.06896552, 0.06451613, 0.00000000, 0.03703704… #> $ def_n 26, 30, 30, 31, 25, 23, 19, 30, 30, 33, 24, 32, 24, 27, 27… #> $ def_scr 0.6538462, 0.7333333, 0.6666667, 0.7741935, 0.6800000, 0.6… #> $ def_scr_1st 0.1923077, 0.2666667, 0.2000000, 0.2580645, 0.2400000, 0.2… #> $ def_scr_2nd 0.2307692, 0.3666667, 0.3666667, 0.3225806, 0.2800000, 0.2… #> $ def_scr_3rd 0.19230769, 0.06666667, 0.06666667, 0.19354839, 0.12000000… #> $ def_scr_4th 0.03846154, 0.03333333, 0.03333333, 0.00000000, 0.04000000… #> $ def_1st 0.5769231, 0.6333333, 0.6000000, 0.7096774, 0.6400000, 0.5… #> $ def_td 0.07692308, 0.10000000, 0.06666667, 0.06451613, 0.04000000… #> $ def_fg 0.03846154, 0.10000000, 0.00000000, 0.09677419, 0.04000000… #> $ def_punt 0.11538462, 0.16666667, 0.20000000, 0.03225806, 0.08000000… #> $ def_to 0.19230769, 0.00000000, 0.13333333, 0.09677419, 0.20000000… #> Rows: 32 #> Columns: 24 #> $ season 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021… #> $ team \"ARI\", \"ATL\", \"BAL\", \"BUF\", \"CAR\", \"CHI\", \"CIN\", \"CLE\", \"D… #> $ off_n 510, 439, 538, 568, 474, 471, 568, 463, 540, 449, 463, 504… #> $ off_scr 0.7431373, 0.6856492, 0.7267658, 0.7834507, 0.6666667, 0.7… #> $ off_scr_1st 0.1843137, 0.2050114, 0.2416357, 0.2605634, 0.2025316, 0.2… #> $ off_scr_2nd 0.3039216, 0.2391800, 0.2918216, 0.2799296, 0.2468354, 0.2… #> $ off_scr_3rd 0.2176471, 0.2118451, 0.1561338, 0.2147887, 0.1856540, 0.1… #> $ off_scr_4th 0.03725490, 0.02961276, 0.03717472, 0.02816901, 0.03164557… #> $ off_1st 0.6431373, 0.6150342, 0.6524164, 0.6637324, 0.6012658, 0.6… #> $ off_td 0.10000000, 0.07061503, 0.07434944, 0.11971831, 0.06540084… #> $ off_fg 0.07254902, 0.06150342, 0.06877323, 0.05633803, 0.06118143… #> $ off_punt 0.11176471, 0.14578588, 0.13197026, 0.09859155, 0.15611814… #> $ off_to 0.07254902, 0.10706150, 0.07249071, 0.06161972, 0.11603376… #> $ def_n 483, 490, 476, 488, 451, 439, 592, 451, 509, 434, 484, 477… #> $ def_scr 0.7142857, 0.7734694, 0.7142857, 0.6762295, 0.6851441, 0.7… #> $ def_scr_1st 0.2380952, 0.2183673, 0.2647059, 0.1885246, 0.2283814, 0.2… #> $ def_scr_2nd 0.2525880, 0.2979592, 0.2605042, 0.2438525, 0.2372506, 0.2… #> $ def_scr_3rd 0.1904762, 0.2306122, 0.1638655, 0.1967213, 0.1929047, 0.2… #> $ def_scr_4th 0.03312629, 0.02653061, 0.02521008, 0.04713115, 0.02660754… #> $ def_1st 0.6252588, 0.6714286, 0.6218487, 0.5983607, 0.5920177, 0.6… #> $ def_td 0.08902692, 0.10204082, 0.09243697, 0.07786885, 0.09312639… #> $ def_fg 0.06211180, 0.05714286, 0.05672269, 0.05737705, 0.08203991… #> $ def_punt 0.13043478, 0.10816327, 0.17436975, 0.16188525, 0.16407982… #> $ def_to 0.09316770, 0.06122449, 0.05462185, 0.10450820, 0.06873614… # }"},{"path":"https://www.nflfastr.com/reference/calculate_standings.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","title":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","text":"function calculates division standings well playoff seeds per conference based either nflverse play--play data nflverse schedule data.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_standings.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","text":"","code":"calculate_standings( nflverse_object, tiebreaker_depth = 3, playoff_seeds = NULL )"},{"path":"https://www.nflfastr.com/reference/calculate_standings.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","text":"nflverse_object Data object class nflverse_data. Either schedules returned fast_scraper_schedules() nflreadr::load_schedules(). play--play data returned load_pbp(), build_nflfastR_pbp(), fast_scraper(). tiebreaker_depth single value equal 1, 2, 3. default 3. value controls depth tiebreakers shall applied. deepest currently implemented tiebreaker strength schedule. following values valid: tiebreaker_depth = 1 Break ties coinflip. Fastest variant. tiebreaker_depth = 2 Apply head--head division win percentage tiebreakers. Random still tied. tiebreaker_depth = 3 Apply tiebreakers strength schedule. Random still tied. playoff_seeds Number playoff teams per conference. NULL (default), function try split nflverse_object seasons prior 2020 (6 seeds) 2020ff (7 seeds). set numeric, used seasons nflverse_object!","code":""},{"path":"https://www.nflfastr.com/reference/calculate_standings.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","text":"tibble NFL regular season standings","code":""},{"path":"https://www.nflfastr.com/reference/calculate_standings.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems # load nflverse data both schedules and pbp scheds <- fast_scraper_schedules(2014) pbp <- load_pbp(c(2018, 2021)) # calculate standings based on pbp calculate_standings(pbp) # calculate standings based on schedules calculate_standings(scheds) }) #> # A tibble: 32 × 15 #> season conf division div_rank seed team games wins losses ties win_pct #> #> 1 2014 AFC AFC East 1 1 NE 16 12 4 0 0.75 #> 2 2014 AFC AFC East 2 NA BUF 16 9 7 0 0.562 #> 3 2014 AFC AFC East 3 NA MIA 16 8 8 0 0.5 #> 4 2014 AFC AFC East 4 NA NYJ 16 4 12 0 0.25 #> 5 2014 AFC AFC North 1 3 PIT 16 11 5 0 0.688 #> 6 2014 AFC AFC North 2 5 CIN 16 10 5 1 0.656 #> 7 2014 AFC AFC North 3 6 BAL 16 10 6 0 0.625 #> 8 2014 AFC AFC North 4 NA CLE 16 7 9 0 0.438 #> 9 2014 AFC AFC South 1 4 IND 16 11 5 0 0.688 #> 10 2014 AFC AFC South 2 NA HOU 16 9 7 0 0.562 #> # ℹ 22 more rows #> # ℹ 4 more variables: div_pct , conf_pct , sov , sos # }"},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute win probability — calculate_win_probability","title":"Compute win probability — calculate_win_probability","text":"provided plays. Returns data probabilities winning game. following columns must present: receive_h2_ko (1 game 1st half possession team receive 2nd half kickoff, 0 otherwise), home_team, posteam, half_seconds_remaining, game_seconds_remaining, spread_line (many points home team favored ), , ydstogo, yardline_100, posteam_timeouts_remaining, defteam_timeouts_remaining","code":""},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute win probability — calculate_win_probability","text":"","code":"calculate_win_probability(pbp_data)"},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute win probability — calculate_win_probability","text":"pbp_data Play--play dataset estimate win probability .","code":""},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute win probability — calculate_win_probability","text":"original pbp_data following columns appended : wp win probability. vegas_wp win probability taking account pre-game spread.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute win probability — calculate_win_probability","text":"Computes win probability provided plays. Returns data spread non-spread-adjusted win probabilities. following columns must present: receive_2h_ko (1 game 1st half possession team receive 2nd half kickoff, 0 otherwise) score_differential home_team posteam half_seconds_remaining game_seconds_remaining spread_line (many points home team favored ) ydstogo yardline_100 posteam_timeouts_remaining defteam_timeouts_remaining","code":""},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute win probability — calculate_win_probability","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems library(dplyr) data <- tibble::tibble( \"receive_2h_ko\" = 0, \"home_team\" = \"SEA\", \"posteam\" = \"SEA\", \"score_differential\" = 0, \"half_seconds_remaining\" = 1800, \"game_seconds_remaining\" = 3600, \"spread_line\" = c(1, 3, 4, 7, 14), \"down\" = 1, \"ydstogo\" = 10, \"yardline_100\" = 75, \"posteam_timeouts_remaining\" = 3, \"defteam_timeouts_remaining\" = 3 ) nflfastR::calculate_win_probability(data) %>% dplyr::select(spread_line, wp, vegas_wp) }) #> # A tibble: 5 × 3 #> spread_line wp vegas_wp #> #> 1 1 0.546 0.515 #> 2 3 0.546 0.596 #> 3 4 0.546 0.638 #> 4 7 0.546 0.737 #> 5 14 0.546 0.866 # }"},{"path":"https://www.nflfastr.com/reference/clean_pbp.html","id":null,"dir":"Reference","previous_headings":"","what":"Clean Play by Play Data — clean_pbp","title":"Clean Play by Play Data — clean_pbp","text":"Clean Play Play Data","code":""},{"path":"https://www.nflfastr.com/reference/clean_pbp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Clean Play by Play Data — clean_pbp","text":"","code":"clean_pbp(pbp, ...)"},{"path":"https://www.nflfastr.com/reference/clean_pbp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Clean Play by Play Data — clean_pbp","text":"pbp Data frame play--play data scraped using fast_scraper(). ... Additional arguments passed message function (internal use).","code":""},{"path":"https://www.nflfastr.com/reference/clean_pbp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Clean Play by Play Data — clean_pbp","text":"input Data Frame parameter 'pbp' following columns added: success Binary indicator wheter epa > 0 given play. passer Name dropback player (scrambles included) including plays penalties. passer_jersey_number Jersey number passer. rusher Name rusher (scrambles) including plays penalties. rusher_jersey_number Jersey number rusher. receiver Name receiver including plays penalties. receiver_jersey_number Jersey number receiver. pass Binary indicator play pass play (sacks scrambles included). rush Binary indicator play rushing play. special Binary indicator play special teams play. first_down Binary indicator play ended first . aborted_play Binary indicator play description indicates \"Aborted\". play Binary indicator: 1 play 'normal' play (including penalties), 0 otherwise. passer_id ID player 'passer' column. rusher_id ID player 'rusher' column. receiver_id ID player 'receiver' column. name Name 'passer' 'NA', name 'rusher' otherwise. fantasy Name rusher rush plays receiver pass plays. fantasy_id ID rusher rush plays receiver pass plays. fantasy_player_name Name rusher rush plays receiver pass plays (official stats). fantasy_player_id ID rusher rush plays receiver pass plays (official stats). jersey_number Jersey number player listed 'name' column. id ID player 'name' column. out_of_bounds = 1 play description contains \"ran ob\", \"pushed ob\", \"sacked ob\"; = 0 otherwise. home_opening_kickoff = 1 home team received opening kickoff, 0 otherwise.","code":""},{"path":"https://www.nflfastr.com/reference/clean_pbp.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Clean Play by Play Data — clean_pbp","text":"Build columns capture happens plays, including penalties, using string extraction play description. Loosely based Ben's nflfastR guide (https://www.nflfastr.com/articles/beginners_guide.html) updated work RS data, different player format play description; e.g. 24-M.Lynch instead M.Lynch. function also standardizes team abbreviations , example, Chargers always represented 'LAC' regardless year . Starting 2022, play--play data missing gsis player IDs rookies. functions tries fix many possible.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/decode_player_ids.html","id":null,"dir":"Reference","previous_headings":"","what":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","title":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","text":"Takes columns ending 'player_id' well variables 'passer_id', 'rusher_id', 'fantasy_id', 'receiver_id', 'id' nflfastR play--play data set decodes player IDs commonly known GSIS ID format 00-00xxxxx. function uses default high efficient decode_ids package gsisdecoder. unlikely event problem function, nflfastR internal decoder can used option fast = FALSE. 2022 play play data introduced new player IDs decoded gsisdecoder. case, IDs joined nflreadr::load_players.","code":""},{"path":"https://www.nflfastr.com/reference/decode_player_ids.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","text":"","code":"decode_player_ids(pbp, ..., fast = TRUE)"},{"path":"https://www.nflfastr.com/reference/decode_player_ids.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","text":"pbp Data frame play--play data scraped using fast_scraper(). ... Additional arguments passed message function (internal use). fast TRUE IDs decoded high efficient function decode_ids. FALSE nflfastR internal function used decoding (generally recommended , unless problem decode_ids can take several days fix CRAN.)","code":""},{"path":"https://www.nflfastr.com/reference/decode_player_ids.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","text":"input data frame parameter pbp decoded player IDs.","code":""},{"path":"https://www.nflfastr.com/reference/decode_player_ids.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","text":"","code":"# \\donttest{ # Decode data frame consisting of some names and ids decode_player_ids(data.frame( name = c(\"P.Mahomes\", \"B.Baldwin\", \"P.Mahomes\", \"S.Carl\", \"J.Jones\"), id = c( \"32013030-2d30-3033-3338-3733fa30c4fa\", NA_character_, \"00-0033873\", NA_character_, \"32013030-2d30-3032-3739-3434d4d3846d\" ) )) #> • 10:53:50 | Decode player ids... #> ✔ 10:53:50 | Decoding of player ids completed #> name id #> 1 P.Mahomes 00-0033873 #> 2 B.Baldwin #> 3 P.Mahomes 00-0033873 #> 4 S.Carl #> 5 J.Jones 00-0027944 # }"},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":null,"dir":"Reference","previous_headings":"","what":"Get NFL Play by Play Data — fast_scraper","title":"Get NFL Play by Play Data — fast_scraper","text":"Load parse NFL play--play data add original nflfastR variables. nflfastR now provides multiple functions add information output function, recommended use build_nflfastR_pbp instead.","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get NFL Play by Play Data — fast_scraper","text":"","code":"fast_scraper( game_ids, dir = getOption(\"nflfastR.raw_directory\", default = NULL), ..., in_builder = FALSE )"},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get NFL Play by Play Data — fast_scraper","text":"game_ids Vector character ids data frame including variable game_id (see details information). dir Path local directory (defaults option \"nflfastR.raw_directory\") nflfastR searches raw game play--play data. See save_raw_pbp() additional information. ... Additional arguments passed scraping functions (internal use) in_builder TRUE, final message suppressed (usage inside build_nflfastR_pbp).","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get NFL Play by Play Data — fast_scraper","text":"Data frame individual row represents single play passed game_ids containing following detailed information (description partly extracted nflscrapR): play_id Numeric play id used game_id drive provides unique identifier single play. game_id Ten digit identifier NFL game. old_game_id Legacy NFL game ID. home_team String abbreviation home team. away_team String abbreviation away team. season_type 'REG' 'POST' indicating game belongs regular post season. week Season week. posteam String abbreviation team possession. posteam_type String indicating whether posteam team home away. defteam String abbreviation team defense. side_of_field String abbreviation team's side field team possession currently . yardline_100 Numeric distance number yards opponent's endzone posteam. game_date Date game. quarter_seconds_remaining Numeric seconds remaining quarter. half_seconds_remaining Numeric seconds remaining half. game_seconds_remaining Numeric seconds remaining game. game_half String indicating half play , either Half1, Half2, Overtime. quarter_end Binary indicator whether row data marking end quarter. drive Numeric drive number game. sp Binary indicator whether score occurred play. qtr Quarter game (5 overtime). given play. goal_to_go Binary indicator whether posteam goal situation. time Time start play provided string format minutes:seconds remaining quarter. yrdln String indicating current field position given play. ydstogo Numeric yards distance either first marker endzone goal situations. ydsnet Numeric value total yards gained given drive. desc Detailed string description given play. play_type String indicating type play: pass (includes sacks), run (includes scrambles), punt, field_goal, kickoff, extra_point, qb_kneel, qb_spike, no_play (timeouts penalties), missing rows indicating end play. yards_gained Numeric yards gained (lost) possessing team, excluding yards gained via fumble recoveries laterals. shotgun Binary indicator whether play shotgun formation. no_huddle Binary indicator whether play no_huddle formation. qb_dropback Binary indicator whether QB dropped back play (pass attempt, sack, scrambled). qb_kneel Binary indicator whether QB took knee. qb_spike Binary indicator whether QB spiked ball. qb_scramble Binary indicator whether QB scrambled. pass_length String indicator pass length: short deep. pass_location String indicator pass location: left, middle, right. air_yards Numeric value distance yards perpendicular line scrimmage targeted receiver either caught catch ball. yards_after_catch Numeric value distance yards perpendicular yard line receiver made reception play ended. run_location String indicator location run: left, middle, right. run_gap String indicator line gap run: end, guard, tackle field_goal_result String indicator result field goal attempt: made, missed, blocked. kick_distance Numeric distance yards kickoffs, field goals, punts. extra_point_result String indicator result extra point attempt: good, failed, blocked, safety (touchback defensive endzone 1 point apparently), aborted. two_point_conv_result String indicator result two point conversion attempt: success, failure, safety (touchback defensive endzone 1 point apparently), return. home_timeouts_remaining Numeric timeouts remaining half home team. away_timeouts_remaining Numeric timeouts remaining half away team. timeout Binary indicator whether timeout called either team. timeout_team String abbreviation team called timeout. td_team String abbreviation team scored touchdown. td_player_name String name player scored touchdown. td_player_id Unique identifier player scored touchdown. posteam_timeouts_remaining Number timeouts remaining possession team. defteam_timeouts_remaining Number timeouts remaining team defense. total_home_score Score home team end play. total_away_score Score away team end play. posteam_score Score posteam start play. defteam_score Score defteam start play. score_differential Score differential posteam defteam start play. posteam_score_post Score posteam end play. defteam_score_post Score defteam end play. score_differential_post Score differential posteam defteam end play. no_score_prob Predicted probability score occurring rest half based expected points model. opp_fg_prob Predicted probability defteam scoring FG next. opp_safety_prob Predicted probability defteam scoring safety next. opp_td_prob Predicted probability defteam scoring TD next. fg_prob Predicted probability posteam scoring FG next. safety_prob Predicted probability posteam scoring safety next. td_prob Predicted probability posteam scoring TD next. extra_point_prob Predicted probability posteam scoring extra point. two_point_conversion_prob Predicted probability posteam scoring two point conversion. ep Using scoring event probabilities, estimated expected points respect possession team given play. epa Expected points added (EPA) posteam given play. total_home_epa Cumulative total EPA home team game far. total_away_epa Cumulative total EPA away team game far. total_home_rush_epa Cumulative total rushing EPA home team game far. total_away_rush_epa Cumulative total rushing EPA away team game far. total_home_pass_epa Cumulative total passing EPA home team game far. total_away_pass_epa Cumulative total passing EPA away team game far. air_epa EPA air yards alone. completions represents actual value provided air. incompletions represents hypothetical value 've added air pass completed. yac_epa EPA yards catch alone. completions represents actual value provided catch. incompletions represents difference hypothetical air_epa play's raw observed EPA (much incomplete pass cost posteam). comp_air_epa EPA air yards alone completions. comp_yac_epa EPA yards catch alone completions. total_home_comp_air_epa Cumulative total completions air EPA home team game far. total_away_comp_air_epa Cumulative total completions air EPA away team game far. total_home_comp_yac_epa Cumulative total completions yac EPA home team game far. total_away_comp_yac_epa Cumulative total completions yac EPA away team game far. total_home_raw_air_epa Cumulative total raw air EPA home team game far. total_away_raw_air_epa Cumulative total raw air EPA away team game far. total_home_raw_yac_epa Cumulative total raw yac EPA home team game far. total_away_raw_yac_epa Cumulative total raw yac EPA away team game far. wp Estimated win probabiity posteam given current situation start given play. def_wp Estimated win probability defteam. home_wp Estimated win probability home team. away_wp Estimated win probability away team. wpa Win probability added (WPA) posteam. vegas_wpa Win probability added (WPA) posteam: spread_adjusted model. vegas_home_wpa Win probability added (WPA) home team: spread_adjusted model. home_wp_post Estimated win probability home team end play. away_wp_post Estimated win probability away team end play. vegas_wp Estimated win probabiity posteam given current situation start given play, incorporating pre-game Vegas line. vegas_home_wp Estimated win probability home team incorporating pre-game Vegas line. total_home_rush_wpa Cumulative total rushing WPA home team game far. total_away_rush_wpa Cumulative total rushing WPA away team game far. total_home_pass_wpa Cumulative total passing WPA home team game far. total_away_pass_wpa Cumulative total passing WPA away team game far. air_wpa WPA air (logic air_epa). yac_wpa WPA yards catch (logic yac_epa). comp_air_wpa air_wpa completions . comp_yac_wpa yac_wpa completions . total_home_comp_air_wpa Cumulative total completions air WPA home team game far. total_away_comp_air_wpa Cumulative total completions air WPA away team game far. total_home_comp_yac_wpa Cumulative total completions yac WPA home team game far. total_away_comp_yac_wpa Cumulative total completions yac WPA away team game far. total_home_raw_air_wpa Cumulative total raw air WPA home team game far. total_away_raw_air_wpa Cumulative total raw air WPA away team game far. total_home_raw_yac_wpa Cumulative total raw yac WPA home team game far. total_away_raw_yac_wpa Cumulative total raw yac WPA away team game far. punt_blocked Binary indicator punt blocked. first_down_rush Binary indicator running play converted first . first_down_pass Binary indicator passing play converted first . first_down_penalty Binary indicator penalty converted first . third_down_converted Binary indicator first converted third . third_down_failed Binary indicator posteam failed convert first third . fourth_down_converted Binary indicator first converted fourth . fourth_down_failed Binary indicator posteam failed convert first fourth . incomplete_pass Binary indicator pass incomplete. touchback Binary indicator touchback occurred play. interception Binary indicator pass intercepted. punt_inside_twenty Binary indicator punt ended inside twenty yard line. punt_in_endzone Binary indicator punt endzone. punt_out_of_bounds Binary indicator punt went bounds. punt_downed Binary indicator punt downed. punt_fair_catch Binary indicator punt caught fair catch. kickoff_inside_twenty Binary indicator kickoff ended inside twenty yard line. kickoff_in_endzone Binary indicator kickoff endzone. kickoff_out_of_bounds Binary indicator kickoff went bounds. kickoff_downed Binary indicator kickoff downed. kickoff_fair_catch Binary indicator kickoff caught fair catch. fumble_forced Binary indicator fumble forced. fumble_not_forced Binary indicator fumble forced. fumble_out_of_bounds Binary indicator fumble went bounds. solo_tackle Binary indicator play solo tackle (multiple due fumbles). safety Binary indicator whether safety occurred. penalty Binary indicator whether penalty occurred. tackled_for_loss Binary indicator whether tackle loss run play occurred. fumble_lost Binary indicator fumble lost. own_kickoff_recovery Binary indicator kicking team recovered kickoff. own_kickoff_recovery_td Binary indicator kicking team recovered kickoff scored TD. qb_hit Binary indicator QB hit play. rush_attempt Binary indicator play run. pass_attempt Binary indicator play pass attempt (includes sacks). sack Binary indicator play ended sack. touchdown Binary indicator play resulted TD. pass_touchdown Binary indicator play resulted passing TD. rush_touchdown Binary indicator play resulted rushing TD. return_touchdown Binary indicator play resulted return TD. extra_point_attempt Binary indicator extra point attempt. two_point_attempt Binary indicator two point conversion attempt. field_goal_attempt Binary indicator field goal attempt. kickoff_attempt Binary indicator kickoff. punt_attempt Binary indicator punts. fumble Binary indicator fumble occurred. complete_pass Binary indicator pass completed. assist_tackle Binary indicator assist tackle occurred. lateral_reception Binary indicator lateral occurred reception. lateral_rush Binary indicator lateral occurred run. lateral_return Binary indicator lateral occurred return. lateral_recovery Binary indicator lateral occurred fumble recovery. passer_player_id Unique identifier player attempted pass. passer_player_name String name player attempted pass. passing_yards Numeric yards passer_player_name, including yards gained pass plays laterals. equal official passing statistics. receiver_player_id Unique identifier receiver targeted pass. receiver_player_name String name targeted receiver. receiving_yards Numeric yards receiver_player_name, excluding yards gained pass plays laterals. equal official receiving statistics miss yards gained pass plays laterals. Please see description lateral_receiver_player_name information. rusher_player_id Unique identifier player attempted run. rusher_player_name String name player attempted run. rushing_yards Numeric yards rusher_player_name, excluding yards gained rush plays laterals. equal official rushing statistics miss yards gained rush plays laterals. Please see description lateral_rusher_player_name information. lateral_receiver_player_id Unique identifier player received last(!) lateral pass play. lateral_receiver_player_name String name player received last(!) lateral pass play. multiple laterals play, last player received lateral. Please see https://github.com/mrcaseb/nfl-data/tree/master/data/lateral_yards list plays multiple players recorded lateral receiving yards. lateral_receiving_yards Numeric yards lateral_receiver_player_name pass plays laterals. Please see description lateral_receiver_player_name information. lateral_rusher_player_id Unique identifier player received last(!) lateral run play. lateral_rusher_player_name String name player received last(!) lateral run play. multiple laterals play, last player received lateral. Please see https://github.com/mrcaseb/nfl-data/tree/master/data/lateral_yards list plays multiple players recorded lateral rushing yards. lateral_rushing_yards Numeric yards lateral_rusher_player_name run plays laterals. Please see description lateral_rusher_player_name information. lateral_sack_player_id Unique identifier player received lateral sack. lateral_sack_player_name String name player received lateral sack. interception_player_id Unique identifier player intercepted pass. interception_player_name String name player intercepted pass. lateral_interception_player_id Unique indentifier player received lateral interception. lateral_interception_player_name String name player received lateral interception. punt_returner_player_id Unique identifier punt returner. punt_returner_player_name String name punt returner. lateral_punt_returner_player_id Unique identifier player received lateral punt return. lateral_punt_returner_player_name String name player received lateral punt return. kickoff_returner_player_name String name kickoff returner. kickoff_returner_player_id Unique identifier kickoff returner. lateral_kickoff_returner_player_id Unique identifier player received lateral kickoff return. lateral_kickoff_returner_player_name String name player received lateral kickoff return. punter_player_id Unique identifier punter. punter_player_name String name punter. kicker_player_name String name kicker FG kickoff. kicker_player_id Unique identifier kicker FG kickoff. own_kickoff_recovery_player_id Unique identifier player recovered kickoff. own_kickoff_recovery_player_name String name player recovered kickoff. blocked_player_id Unique identifier player blocked punt FG. blocked_player_name String name player blocked punt FG. tackle_for_loss_1_player_id Unique identifier one potential players tackle loss. tackle_for_loss_1_player_name String name one potential players tackle loss. tackle_for_loss_2_player_id Unique identifier one potential players tackle loss. tackle_for_loss_2_player_name String name one potential players tackle loss. qb_hit_1_player_id Unique identifier one potential players hit QB. sack QB ball carrier. sacks please see sack_player half_sack_*_player. qb_hit_1_player_name String name one potential players hit QB. sack QB ball carrier. sacks please see sack_player half_sack_*_player. qb_hit_2_player_id Unique identifier one potential players hit QB. sack QB ball carrier. sacks please see sack_player half_sack_*_player. qb_hit_2_player_name String name one potential players hit QB. sack QB ball carrier. sacks please see sack_player half_sack_*_player. forced_fumble_player_1_team Team one players forced fumble. forced_fumble_player_1_player_id Unique identifier one players forced fumble. forced_fumble_player_1_player_name String name one players forced fumble. forced_fumble_player_2_team Team one players forced fumble. forced_fumble_player_2_player_id Unique identifier one players forced fumble. forced_fumble_player_2_player_name String name one players forced fumble. solo_tackle_1_team Team one players solo tackle. solo_tackle_2_team Team one players solo tackle. solo_tackle_1_player_id Unique identifier one players solo tackle. solo_tackle_2_player_id Unique identifier one players solo tackle. solo_tackle_1_player_name String name one players solo tackle. solo_tackle_2_player_name String name one players solo tackle. assist_tackle_1_player_id Unique identifier one players tackle assist. assist_tackle_1_player_name String name one players tackle assist. assist_tackle_1_team Team one players tackle assist. assist_tackle_2_player_id Unique identifier one players tackle assist. assist_tackle_2_player_name String name one players tackle assist. assist_tackle_2_team Team one players tackle assist. assist_tackle_3_player_id Unique identifier one players tackle assist. assist_tackle_3_player_name String name one players tackle assist. assist_tackle_3_team Team one players tackle assist. assist_tackle_4_player_id Unique identifier one players tackle assist. assist_tackle_4_player_name String name one players tackle assist. assist_tackle_4_team Team one players tackle assist. tackle_with_assist Binary indicator tackle assist. tackle_with_assist_1_player_id Unique identifier one players tackle assist. tackle_with_assist_1_player_name String name one players tackle assist. tackle_with_assist_1_team Team one players tackle assist. tackle_with_assist_2_player_id Unique identifier one players tackle assist. tackle_with_assist_2_player_name String name one players tackle assist. tackle_with_assist_2_team Team one players tackle assist. pass_defense_1_player_id Unique identifier one players pass defense. pass_defense_1_player_name String name one players pass defense. pass_defense_2_player_id Unique identifier one players pass defense. pass_defense_2_player_name String name one players pass defense. fumbled_1_team Team one first player fumble. fumbled_1_player_id Unique identifier first player fumbled play. fumbled_1_player_name String name one first player fumbled play. fumbled_2_player_id Unique identifier second player fumbled play. fumbled_2_player_name String name one second player fumbled play. fumbled_2_team Team one second player fumble. fumble_recovery_1_team Team one players fumble recovery. fumble_recovery_1_yards Yards gained one players fumble recovery. fumble_recovery_1_player_id Unique identifier one players fumble recovery. fumble_recovery_1_player_name String name one players fumble recovery. fumble_recovery_2_team Team one players fumble recovery. fumble_recovery_2_yards Yards gained one players fumble recovery. fumble_recovery_2_player_id Unique identifier one players fumble recovery. fumble_recovery_2_player_name String name one players fumble recovery. sack_player_id Unique identifier player recorded solo sack. sack_player_name String name player recorded solo sack. half_sack_1_player_id Unique identifier first player recorded half sack. half_sack_1_player_name String name first player recorded half sack. half_sack_2_player_id Unique identifier second player recorded half sack. half_sack_2_player_name String name second player recorded half sack. return_team String abbreviation return team. return_yards Yards gained return team. penalty_team String abbreviation team penalty. penalty_player_id Unique identifier player penalty. penalty_player_name String name player penalty. penalty_yards Yards gained (lost) posteam penalty. replay_or_challenge Binary indicator whether replay challenge. replay_or_challenge_result String indicating result replay challenge. penalty_type String indicating penalty type first penalty given play. NA desc missing type. defensive_two_point_attempt Binary indicator whether defense able attempt two point conversion, results following turnover. defensive_two_point_conv Binary indicator whether defense successfully scored two point conversion. defensive_extra_point_attempt Binary indicator whether defense able attempt extra point attempt, results following blocked attempt defense recovers ball. defensive_extra_point_conv Binary indicator whether defense successfully scored extra point attempt. safety_player_name String name player scored safety. safety_player_id Unique identifier player scored safety. season 4 digit number indicating season game belongs . cp Numeric value indicating probability complete pass based comparable game situations. cpoe single pass play 1 - cp pass completed 0 - cp pass incomplete. Analyzed whole game season indicator passer much expectation completion percentage . series Starts 1, new first increments, numbers shared across teams NA: kickoffs, extra point/two point conversion attempts, non-plays, posteam series_success 1: scored touchdown, gained enough yards first . series_result Possible values: First , Touchdown, Opp touchdown, Field goal, Missed field goal, Safety, Turnover, Punt, Turnover downs, QB kneel, End half start_time Kickoff time eastern time zone. order_sequence Column provided NFL fix --order plays. Available 2011 beyond source \"nfl\". time_of_day Time day play UTC \"HH:MM:SS\" format. Available 2011 beyond source \"nfl\". stadium Game site name. weather String describing weather including temperature, humidity wind (direction speed). change game! nfl_api_id UUID game new NFL API. play_clock Time playclock ball snapped. play_deleted Binary indicator deleted plays. play_type_nfl Play type listed NFL source. Slightly different regular play_type variable. special_teams_play Binary indicator whether play special teams play NFL source. Available 2011 beyond source \"nfl\". st_play_type Type special teams play NFL source. Available 2011 beyond source \"nfl\". end_clock_time Game time end given play. end_yard_line String indicating yardline end given play consisting team half yard line number. drive_real_start_time Local day time drive started (currently used NFL therefore mostly 'NA'). drive_play_count Numeric value many regular plays happened given drive. drive_time_of_possession Time possession given drive. drive_first_downs Number forst downs given drive. drive_inside20 Binary indicator offense able get inside opponents 20 yard line. drive_ended_with_score Binary indicator drive ended score. drive_quarter_start Numeric value indicating quarter given drive started. drive_quarter_end Numeric value indicating quarter given drive ended. drive_yards_penalized Numeric value many yards offense gained lost penalties given drive. drive_start_transition String indicating offense got ball. drive_end_transition String indicating offense lost ball. drive_game_clock_start Game time beginning given drive. drive_game_clock_end Game time end given drive. drive_start_yard_line String indicating given drive started consisting team half yard line number. drive_end_yard_line String indicating given drive ended consisting team half yard line number. drive_play_id_started Play_id first play given drive. drive_play_id_ended Play_id last play given drive. fixed_drive Manually created drive number game. fixed_drive_result Manually created drive result. away_score Total points scored away team. home_score Total points scored home team. location Either 'Home' o 'Neutral' indicating home team played home neutral site. result Equals home_score - away_score means game outcome perspective home team. total Equals home_score + away_score means total points scored given game. spread_line closing spread line game. positive number means home team favored many points, negative number means away team favored many points. (Source: Pro-Football-Reference) total_line closing total line game. (Source: Pro-Football-Reference) div_game Binary indicator given game division game. roof One 'dome', 'outdoors', 'closed', 'open' indicating indicating roof status stadium game played . (Source: Pro-Football-Reference) surface type ground game played . (Source: Pro-Football-Reference) temp temperature stadium 'roof' = 'outdoors' 'open'.(Source: Pro-Football-Reference) wind speed wind miles/hour 'roof' = 'outdoors' 'open'. (Source: Pro-Football-Reference) home_coach First last name home team coach. (Source: Pro-Football-Reference) away_coach First last name away team coach. (Source: Pro-Football-Reference) stadium_id ID stadium game played . (Source: Pro-Football-Reference) game_stadium Name stadium game played . (Source: Pro-Football-Reference)","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get NFL Play by Play Data — fast_scraper","text":"load valid game_ids please use package function fast_scraper_schedules (function can directly handle output function)","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get NFL Play by Play Data — fast_scraper","text":"","code":"# \\donttest{ # Get pbp data for two games try({# to avoid CRAN test problems fast_scraper(c(\"2019_01_GB_CHI\", \"2013_21_SEA_DEN\")) }) #> ℹ It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan(\"multisession\")`! Will go on sequentially... #> ✔ 10:53:52 | Download finished. Adding variables... #> ✔ 10:53:52 | added game variables #> ✔ 10:53:52 | added nflscrapR variables #> ✔ 10:53:53 | added ep variables #> ✔ 10:53:53 | added air_yac_ep variables #> ✔ 10:53:53 | added wp variables #> ✔ 10:53:53 | added air_yac_wp variables #> ✔ 10:53:53 | added cp and cpoe #> ✔ 10:53:53 | added fixed drive variables #> ✔ 10:53:53 | added series variables #> ✔ 10:53:53 | Procedure completed. #> ── nflverse play by play ─────────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 10:53:53 UTC #> # A tibble: 337 × 339 #> play_id game_id old_game_id home_team away_team season_type week posteam #> #> 1 1 2013_21_SE… 2014020200 DEN SEA POST 21 NA #> 2 37 2013_21_SE… 2014020200 DEN SEA POST 21 NA #> 3 61 2013_21_SE… 2014020200 DEN SEA POST 21 DEN #> 4 83 2013_21_SE… 2014020200 DEN SEA POST 21 DEN #> 5 119 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> 6 141 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> 7 162 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> 8 183 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> 9 210 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> 10 232 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> # ℹ 327 more rows #> # ℹ 331 more variables: posteam_type , defteam , side_of_field , #> # yardline_100 , game_date , quarter_seconds_remaining , #> # half_seconds_remaining , game_seconds_remaining , #> # game_half , quarter_end , drive , sp , qtr , #> # down , goal_to_go , time , yrdln , ydstogo , #> # ydsnet , desc , play_type , yards_gained , … # It is also possible to directly use the # output of `fast_scraper_schedules` as input try({# to avoid CRAN test problems library(dplyr, warn.conflicts = FALSE) fast_scraper_schedules(2020) %>% slice_tail(n = 3) %>% fast_scraper() }) #> ℹ It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan(\"multisession\")`! Will go on sequentially... #> ✔ 10:53:56 | Download finished. Adding variables... #> ✔ 10:53:56 | added game variables #> ✔ 10:53:56 | added nflscrapR variables #> ✔ 10:53:56 | added ep variables #> ✔ 10:53:56 | added air_yac_ep variables #> ✔ 10:53:57 | added wp variables #> ✔ 10:53:57 | added air_yac_wp variables #> ✔ 10:53:57 | added cp and cpoe #> ✔ 10:53:57 | added fixed drive variables #> ✔ 10:53:57 | added series variables #> ✔ 10:53:57 | Procedure completed. #> ── nflverse play by play ─────────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 10:53:57 UTC #> # A tibble: 539 × 339 #> play_id game_id old_game_id home_team away_team season_type week posteam #> #> 1 1 2020_20_BU… 2021012401 KC BUF POST 20 NA #> 2 42 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 3 57 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 4 78 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 5 102 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 6 123 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 7 145 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 8 174 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 9 207 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 10 236 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> # ℹ 529 more rows #> # ℹ 331 more variables: posteam_type , defteam , side_of_field , #> # yardline_100 , game_date , quarter_seconds_remaining , #> # half_seconds_remaining , game_seconds_remaining , #> # game_half , quarter_end , drive , sp , qtr , #> # down , goal_to_go , time , yrdln , ydstogo , #> # ydsnet , desc , play_type , yards_gained , … # \\dontshow{ # Close open connections for R CMD Check future::plan(\"sequential\") # } # }"},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":null,"dir":"Reference","previous_headings":"","what":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"Load Rosters","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"","code":"fast_scraper_roster(...)"},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"... Arguments passed nflreadr::load_rosters seasons numeric vector seasons return, defaults returning year's data March later. set TRUE, return available data. Data available back 1920. file_type One c(\"rds\", \"qs\", \"csv\", \"parquet\"). Can also set globally options(nflreadr.prefer)","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"tibble season-level roster data.","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"See nflreadr::load_rosters details.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"","code":"# \\donttest{ # Roster of the 2019 and 2020 seasons try({# to avoid CRAN test problems fast_scraper_roster(2019:2020) }) #> ── nflverse roster data ──────────────────────────────────────────────────────── #> ℹ Data updated: 2023-09-13 01:04:45 UTC #> # A tibble: 6,182 × 36 #> season team position depth_chart_position jersey_number status full_name #> #> 1 2019 IND K K 4 RES Adam Vinatie… #> 2 2019 NE QB QB 12 ACT Tom Brady #> 3 2019 NO QB QB 9 ACT Drew Brees #> 4 2019 ATL K K 3 CUT Matt Bryant #> 5 2019 PHI QB QB 18 ACT Josh McCown #> 6 2019 DAL TE TE 82 ACT Jason Witten #> 7 2019 KC LB OLB 94 ACT Terrell Suggs #> 8 2019 HOU DB FS 27 ACT Mike Adams #> 9 2019 DET LS LS 48 ACT Don Muhlbach #> 10 2019 PHI OL OT 71 ACT Jason Peters #> # ℹ 6,172 more rows #> # ℹ 29 more variables: first_name , last_name , birth_date , #> # height , weight , college , gsis_id , espn_id , #> # sportradar_id , yahoo_id , rotowire_id , pff_id , #> # pfr_id , fantasy_data_id , sleeper_id , years_exp , #> # headshot_url , ngs_position , week , game_type , #> # status_description_abbr , football_name , esb_id , … # }"},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":null,"dir":"Reference","previous_headings":"","what":"Load NFL Season Schedules — fast_scraper_schedules","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"returns game/schedule information maintained Lee Sharpe.","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"","code":"fast_scraper_schedules(...)"},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"... Arguments passed nflreadr::load_schedules seasons numeric vector seasons return, default TRUE returns available data.","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"tibble game information past /future games.","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"See nflreadr::load_schedules details.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"","code":"# \\donttest{ # Get schedules for the whole 2015 - 2018 seasons try({# to avoid CRAN test problems fast_scraper_schedules(2015:2018) }) #> ── nflverse games and schedules ──────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 10:53:59 UTC #> # A tibble: 1,068 × 46 #> game_id season game_type week gameday weekday gametime away_team away_score #> #> 1 2015_01… 2015 REG 1 2015-0… Thursd… 20:30 PIT 21 #> 2 2015_01… 2015 REG 1 2015-0… Sunday 13:00 IND 14 #> 3 2015_01… 2015 REG 1 2015-0… Sunday 13:00 GB 31 #> 4 2015_01… 2015 REG 1 2015-0… Sunday 13:00 KC 27 #> 5 2015_01… 2015 REG 1 2015-0… Sunday 13:00 CAR 20 #> 6 2015_01… 2015 REG 1 2015-0… Sunday 13:00 CLE 10 #> 7 2015_01… 2015 REG 1 2015-0… Sunday 13:00 SEA 31 #> 8 2015_01… 2015 REG 1 2015-0… Sunday 13:00 MIA 17 #> 9 2015_01… 2015 REG 1 2015-0… Sunday 16:05 NO 19 #> 10 2015_01… 2015 REG 1 2015-0… Sunday 16:05 DET 28 #> # ℹ 1,058 more rows #> # ℹ 37 more variables: home_team , home_score , location , #> # result , total , overtime , old_game_id , gsis , #> # nfl_detail_id , pfr , pff , espn , ftn , #> # away_rest , home_rest , away_moneyline , #> # home_moneyline , spread_line , away_spread_odds , #> # home_spread_odds , total_line , under_odds , … # }"},{"path":"https://www.nflfastr.com/reference/field_descriptions.html","id":null,"dir":"Reference","previous_headings":"","what":"nflfastR Field Descriptions — field_descriptions","title":"nflfastR Field Descriptions — field_descriptions","text":"nflfastR Field Descriptions","code":""},{"path":"https://www.nflfastr.com/reference/field_descriptions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"nflfastR Field Descriptions — field_descriptions","text":"","code":"field_descriptions"},{"path":"https://www.nflfastr.com/reference/field_descriptions.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"nflfastR Field Descriptions — field_descriptions","text":"data frame including names descriptions variables nflfastR dataset.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/field_descriptions.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"nflfastR Field Descriptions — field_descriptions","text":"","code":"# \\donttest{ field_descriptions #> # A tibble: 372 × 2 #> Field Description #> #> 1 play_id Numeric play id that when used with game_id and drive provides … #> 2 game_id Ten digit identifier for NFL game. #> 3 old_game_id Legacy NFL game ID. #> 4 home_team String abbreviation for the home team. #> 5 away_team String abbreviation for the away team. #> 6 season_type 'REG' or 'POST' indicating if the game belongs to regular or po… #> 7 week Season week. #> 8 posteam String abbreviation for the team with possession. #> 9 posteam_type String indicating whether the posteam team is home or away. #> 10 defteam String abbreviation for the team on defense. #> # ℹ 362 more rows # }"},{"path":"https://www.nflfastr.com/reference/load_pbp.html","id":null,"dir":"Reference","previous_headings":"","what":"Load Play By Play — load_pbp","title":"Load Play By Play — load_pbp","text":"Loads play play seasons nflverse-data repository","code":""},{"path":"https://www.nflfastr.com/reference/load_pbp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load Play By Play — load_pbp","text":"","code":"load_pbp(...)"},{"path":"https://www.nflfastr.com/reference/load_pbp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load Play By Play — load_pbp","text":"... Arguments passed nflreadr::load_pbp seasons numeric vector 4-digit years associated given NFL seasons - defaults latest season. set TRUE, returns available data since 1999. file_type One c(\"rds\", \"qs\", \"csv\", \"parquet\"). Can also set globally options(nflreadr.prefer)","code":""},{"path":"https://www.nflfastr.com/reference/load_pbp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load Play By Play — load_pbp","text":"complete nflfastR dataset returned nflfastR::build_nflfastR_pbp() (see ) given seasons","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/load_pbp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Load Play By Play — load_pbp","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems pbp <- load_pbp(2019:2020) dplyr::glimpse(pbp) }) #> Rows: 94,965 #> Columns: 372 #> $ play_id 1, 36, 51, 79, 100, 121, 148, 185… #> $ game_id \"2019_01_ATL_MIN\", \"2019_01_ATL_M… #> $ old_game_id \"2019090804\", \"2019090804\", \"2019… #> $ home_team \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\"… #> $ away_team \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\"… #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\"… #> $ week 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, … #> $ posteam NA, \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"… #> $ posteam_type NA, \"away\", \"away\", \"away\", \"away… #> $ defteam NA, \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"… #> $ side_of_field NA, \"MIN\", \"ATL\", \"ATL\", \"ATL\", \"… #> $ yardline_100 NA, 35, 75, 83, 79, 67, 21, 31, 2… #> $ game_date \"2019-09-08\", \"2019-09-08\", \"2019… #> $ quarter_seconds_remaining 900, 900, 900, 860, 821, 779, 773… #> $ half_seconds_remaining 1800, 1800, 1800, 1760, 1721, 167… #> $ game_seconds_remaining 3600, 3600, 3600, 3560, 3521, 347… #> $ game_half \"Half1\", \"Half1\", \"Half1\", \"Half1… #> $ quarter_end 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ drive NA, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3,… #> $ sp 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, … #> $ qtr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, … #> $ down NA, NA, 1, 2, 3, 4, 1, 1, 2, NA, … #> $ goal_to_go 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ time \"15:00\", \"15:00\", \"15:00\", \"14:20… #> $ yrdln \"MIN 35\", \"MIN 35\", \"ATL 25\", \"AT… #> $ ydstogo 0, 0, 10, 18, 14, 2, 10, 20, 12, … #> $ ydsnet NA, 8, 8, 8, 8, 8, 21, 21, 21, 21… #> $ desc \"GAME\", \"5-D.Bailey kicks 65 yard… #> $ play_type NA, \"kickoff\", \"pass\", \"run\", \"ru… #> $ yards_gained NA, 0, -8, 4, 12, 0, 0, 8, 23, 0,… #> $ shotgun 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, … #> $ no_huddle 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ qb_dropback NA, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0,… #> $ qb_kneel 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ qb_spike 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ qb_scramble 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, … #> $ pass_length NA, NA, NA, NA, NA, NA, NA, \"shor… #> $ pass_location NA, NA, NA, NA, NA, NA, NA, \"left… #> $ air_yards NA, NA, NA, NA, NA, NA, NA, 1, 11… #> $ yards_after_catch NA, NA, NA, NA, NA, NA, NA, 7, 12… #> $ run_location NA, NA, NA, \"right\", \"left\", NA, … #> $ run_gap NA, NA, NA, \"tackle\", \"end\", NA, … #> $ field_goal_result NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ kick_distance NA, 65, NA, NA, NA, 0, NA, NA, NA… #> $ extra_point_result NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ two_point_conv_result NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ home_timeouts_remaining 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, … #> $ away_timeouts_remaining 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, … #> $ timeout NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ timeout_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ td_team NA, NA, NA, NA, NA, NA, NA, NA, \"… #> $ td_player_name NA, NA, NA, NA, NA, NA, NA, NA, \"… #> $ td_player_id NA, NA, NA, NA, NA, NA, NA, NA, \"… #> $ posteam_timeouts_remaining NA, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,… #> $ defteam_timeouts_remaining NA, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,… #> $ total_home_score 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7, … #> $ total_away_score 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ posteam_score NA, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0,… #> $ defteam_score NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,… #> $ score_differential NA, 0, 0, 0, 0, 0, 0, 0, 0, 6, -7… #> $ posteam_score_post NA, 0, 0, 0, 0, 0, 0, 0, 6, 7, 0,… #> $ defteam_score_post NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,… #> $ score_differential_post NA, 0, 0, 0, 0, 0, 0, 0, 6, 7, -7… #> $ no_score_prob 0.000000000, 0.003473236, 0.00347… #> $ opp_fg_prob 0.00000000, 0.12887874, 0.1288787… #> $ opp_safety_prob 0.0000000000, 0.0022700424, 0.002… #> $ opp_td_prob 0.00000000, 0.27208826, 0.2720882… #> $ fg_prob 0.0000000, 0.2081953, 0.2081953, … #> $ safety_prob 0.0000000000, 0.0032402442, 0.003… #> $ td_prob 0.0000000, 0.3818542, 0.3818542, … #> $ extra_point_prob 0.0000000, 0.0000000, 0.0000000, … #> $ two_point_conversion_prob 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ ep 1.0082514, 1.0082514, 1.0082514, … #> $ epa 0.00000000, 0.00000000, -1.658763… #> $ total_home_epa 0.000000, 0.000000, 1.658763, 2.1… #> $ total_away_epa 0.000000, 0.000000, -1.658763, -2… #> $ total_home_rush_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_away_rush_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_home_pass_epa 0.000000, 0.000000, 1.658763, 1.6… #> $ total_away_pass_epa 0.000000, 0.000000, -1.658763, -1… #> $ air_epa NA, NA, NA, NA, NA, NA, NA, -0.55… #> $ yac_epa NA, NA, NA, NA, NA, NA, NA, 0.811… #> $ comp_air_epa NA, 0.0000000, 0.0000000, 0.00000… #> $ comp_yac_epa NA, 0.0000000, 0.0000000, 0.00000… #> $ total_home_comp_air_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_away_comp_air_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_home_comp_yac_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_away_comp_yac_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_home_raw_air_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_away_raw_air_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_home_raw_yac_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_away_raw_yac_epa 0.0000000, 0.0000000, 0.0000000, … #> $ wp 0.4332080, 0.4332080, 0.4332080, … #> $ def_wp 0.5667920, 0.5667920, 0.5667920, … #> $ home_wp 0.5667920, 0.5667920, 0.5667920, … #> $ away_wp 0.4332080, 0.4332080, 0.4332080, … #> $ wpa 0.0000000000, 0.0000000000, -0.03… #> $ vegas_wpa 0.0000000000, 0.0000000000, -0.04… #> $ vegas_home_wpa 0.0000000000, 0.0000000000, 0.049… #> $ home_wp_post NA, 0.5667920, 0.6018074, 0.62024… #> $ away_wp_post NA, 0.4332080, 0.3981926, 0.37975… #> $ vegas_wp 0.36757040, 0.36757040, 0.3675704… #> $ vegas_home_wp 0.6324296, 0.6324296, 0.6324296, … #> $ total_home_rush_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_away_rush_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_home_pass_wpa 0.00000000, 0.00000000, 0.0350153… #> $ total_away_pass_wpa 0.00000000, 0.00000000, -0.035015… #> $ air_wpa NA, NA, NA, NA, NA, NA, NA, 0.000… #> $ yac_wpa NA, NA, NA, NA, NA, NA, NA, 0.006… #> $ comp_air_wpa NA, 0.0000000000, 0.0000000000, 0… #> $ comp_yac_wpa NA, 0.0000000000, 0.0000000000, 0… #> $ total_home_comp_air_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_away_comp_air_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_home_comp_yac_wpa 0.000000000, 0.000000000, 0.00000… #> $ total_away_comp_yac_wpa 0.000000000, 0.000000000, 0.00000… #> $ total_home_raw_air_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_away_raw_air_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_home_raw_yac_wpa 0.000000000, 0.000000000, 0.00000… #> $ total_away_raw_yac_wpa 0.000000000, 0.000000000, 0.00000… #> $ punt_blocked NA, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,… #> $ first_down_rush NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ first_down_pass NA, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,… #> $ first_down_penalty NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ third_down_converted NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ third_down_failed NA, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,… #> $ fourth_down_converted NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ fourth_down_failed NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ incomplete_pass NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ touchback 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ interception NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ punt_inside_twenty NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ punt_in_endzone NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ punt_out_of_bounds NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ punt_downed NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ punt_fair_catch NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ kickoff_inside_twenty NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,… #> $ kickoff_in_endzone NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,… #> $ kickoff_out_of_bounds NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ kickoff_downed NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ kickoff_fair_catch NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ fumble_forced NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ fumble_not_forced NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ fumble_out_of_bounds NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ solo_tackle NA, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1,… #> $ safety NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ penalty NA, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,… #> $ tackled_for_loss NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ fumble_lost NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ own_kickoff_recovery NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ own_kickoff_recovery_td NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ qb_hit NA, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,… #> $ rush_attempt NA, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,… #> $ pass_attempt NA, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0,… #> $ sack NA, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ touchdown NA, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,… #> $ pass_touchdown NA, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,… #> $ rush_touchdown NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ return_touchdown NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ extra_point_attempt NA, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,… #> $ two_point_attempt NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ field_goal_attempt NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ kickoff_attempt NA, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,… #> $ punt_attempt NA, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,… #> $ fumble NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ complete_pass NA, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,… #> $ assist_tackle NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ lateral_reception NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ lateral_rush NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ lateral_return NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ lateral_recovery NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ passer_player_id NA, NA, \"00-0026143\", NA, NA, NA,… #> $ passer_player_name NA, NA, \"M.Ryan\", NA, NA, NA, NA,… #> $ passing_yards NA, NA, NA, NA, NA, NA, NA, 8, 23… #> $ receiver_player_id NA, NA, NA, NA, NA, NA, NA, \"00-0… #> $ receiver_player_name NA, NA, NA, NA, NA, NA, NA, \"D.Co… #> $ receiving_yards NA, NA, NA, NA, NA, NA, NA, 8, 23… #> $ rusher_player_id NA, NA, NA, \"00-0031285\", \"00-002… #> $ rusher_player_name NA, NA, NA, \"D.Freeman\", \"M.Ryan\"… #> $ rushing_yards NA, NA, NA, 4, 12, NA, NA, NA, NA… #> $ lateral_receiver_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_receiver_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_receiving_yards NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_rusher_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_rusher_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_rushing_yards NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_sack_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_sack_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ interception_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ interception_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_interception_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_interception_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ punt_returner_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ punt_returner_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_punt_returner_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_punt_returner_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ kickoff_returner_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ kickoff_returner_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_kickoff_returner_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_kickoff_returner_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ punter_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ punter_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ kicker_player_name NA, \"D.Bailey\", NA, NA, NA, NA, N… #> $ kicker_player_id NA, \"00-0028660\", NA, NA, NA, NA,… #> $ own_kickoff_recovery_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ own_kickoff_recovery_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ blocked_player_id NA, NA, NA, NA, NA, \"00-0033336\",… #> $ blocked_player_name NA, NA, NA, NA, NA, \"E.Wilson\", N… #> $ tackle_for_loss_1_player_id NA, NA, \"00-0031256\", NA, NA, NA,… #> $ tackle_for_loss_1_player_name NA, NA, \"A.Barr\", NA, NA, NA, NA,… #> $ tackle_for_loss_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_for_loss_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ qb_hit_1_player_id NA, NA, \"00-0031256\", NA, NA, NA,… #> $ qb_hit_1_player_name NA, NA, \"A.Barr\", NA, NA, NA, NA,… #> $ qb_hit_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ qb_hit_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_1_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ solo_tackle_1_team NA, NA, \"MIN\", \"MIN\", \"MIN\", \"ATL… #> $ solo_tackle_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ solo_tackle_1_player_id NA, NA, \"00-0031256\", \"00-0031242… #> $ solo_tackle_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ solo_tackle_1_player_name NA, NA, \"A.Barr\", \"S.Stephen\", \"A… #> $ solo_tackle_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_1_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_3_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_3_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_3_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_4_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_4_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_4_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ tackle_with_assist_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist_1_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ pass_defense_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ pass_defense_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ pass_defense_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ pass_defense_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_1_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_1_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_1_yards NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_2_yards NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ sack_player_id NA, NA, \"00-0031256\", NA, NA, NA,… #> $ sack_player_name NA, NA, \"A.Barr\", NA, NA, NA, NA,… #> $ half_sack_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ half_sack_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ half_sack_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ half_sack_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ return_team NA, \"ATL\", NA, NA, NA, NA, NA, NA… #> $ return_yards NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18… #> $ penalty_team NA, NA, NA, NA, NA, NA, \"MIN\", NA… #> $ penalty_player_id NA, NA, NA, NA, NA, NA, \"00-00279… #> $ penalty_player_name NA, NA, NA, NA, NA, NA, \"K.Rudolp… #> $ penalty_yards NA, NA, NA, NA, NA, NA, 10, NA, N… #> $ replay_or_challenge 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ replay_or_challenge_result NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ penalty_type NA, NA, NA, NA, NA, NA, \"Offensiv… #> $ defensive_two_point_attempt NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ defensive_two_point_conv NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ defensive_extra_point_attempt NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ defensive_extra_point_conv NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ safety_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ safety_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ season 2019, 2019, 2019, 2019, 2019, 201… #> $ cp NA, NA, NA, NA, NA, NA, NA, 0.844… #> $ cpoe NA, NA, NA, NA, NA, NA, NA, 15.57… #> $ series 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, … #> $ series_success 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, … #> $ series_result \"Punt\", \"Punt\", \"Punt\", \"Punt\", \"… #> $ order_sequence 1, 36, 51, 79, 100, 121, 148, 185… #> $ start_time \"13:00:00\", \"13:00:00\", \"13:00:00… #> $ time_of_day NA, \"17:04:02\", \"17:04:42\", \"17:0… #> $ stadium \"U.S. Bank Stadium\", \"U.S. Bank S… #> $ weather \"N/A (Indoors) Temp: ° F, Wind: … #> $ nfl_api_id \"10160000-0579-055e-7350-c0a2552a… #> $ play_clock \"0\", \"10\", \"12\", \"5\", \"7\", \"17\", … #> $ play_deleted 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ play_type_nfl \"GAME_START\", \"KICK_OFF\", \"SACK\",… #> $ special_teams_play 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, … #> $ st_play_type NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ end_clock_time NA, NA, NA, NA, NA, \"12:53\", NA, … #> $ end_yard_line NA, \"ATL 25\", \"ATL 17\", \"ATL 21\",… #> $ fixed_drive 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, … #> $ fixed_drive_result \"Punt\", \"Punt\", \"Punt\", \"Punt\", \"… #> $ drive_real_start_time NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ drive_play_count NA, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3,… #> $ drive_time_of_possession NA, \"2:07\", \"2:07\", \"2:07\", \"2:07… #> $ drive_first_downs NA, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,… #> $ drive_inside20 NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ drive_ended_with_score NA, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,… #> $ drive_quarter_start NA, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,… #> $ drive_quarter_end NA, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,… #> $ drive_yards_penalized NA, 0, 0, 0, 0, 0, -10, -10, -10,… #> $ drive_start_transition NA, \"KICKOFF\", \"KICKOFF\", \"KICKOF… #> $ drive_end_transition NA, \"BLOCKED_PUNT\", \"BLOCKED_PUNT… #> $ drive_game_clock_start NA, \"15:00\", \"15:00\", \"15:00\", \"1… #> $ drive_game_clock_end NA, \"12:53\", \"12:53\", \"12:53\", \"1… #> $ drive_start_yard_line NA, \"ATL 25\", \"ATL 25\", \"ATL 25\",… #> $ drive_end_yard_line NA, \"ATL 33\", \"ATL 33\", \"ATL 33\",… #> $ drive_play_id_started NA, 36, 36, 36, 36, 36, 148, 148,… #> $ drive_play_id_ended NA, 121, 121, 121, 121, 121, 239,… #> $ away_score 12, 12, 12, 12, 12, 12, 12, 12, 1… #> $ home_score 28, 28, 28, 28, 28, 28, 28, 28, 2… #> $ location \"Home\", \"Home\", \"Home\", \"Home\", \"… #> $ result 16, 16, 16, 16, 16, 16, 16, 16, 1… #> $ total 40, 40, 40, 40, 40, 40, 40, 40, 4… #> $ spread_line 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5… #> $ total_line 47, 47, 47, 47, 47, 47, 47, 47, 4… #> $ div_game 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ roof \"dome\", \"dome\", \"dome\", \"dome\", \"… #> $ surface \"sportturf\", \"sportturf\", \"sportt… #> $ temp NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ wind NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ home_coach \"Mike Zimmer\", \"Mike Zimmer\", \"Mi… #> $ away_coach \"Dan Quinn\", \"Dan Quinn\", \"Dan Qu… #> $ stadium_id \"MIN01\", \"MIN01\", \"MIN01\", \"MIN01… #> $ game_stadium \"U.S. Bank Stadium\", \"U.S. Bank S… #> $ aborted_play 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ success 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, … #> $ passer NA, NA, \"M.Ryan\", NA, \"M.Ryan\", N… #> $ passer_jersey_number NA, NA, 2, NA, 2, NA, NA, 8, 8, N… #> $ rusher NA, NA, NA, \"D.Freeman\", NA, NA, … #> $ rusher_jersey_number NA, NA, NA, 24, 2, NA, 33, NA, NA… #> $ receiver NA, NA, NA, NA, NA, NA, NA, \"D.Co… #> $ receiver_jersey_number NA, NA, NA, NA, NA, NA, NA, 33, 1… #> $ pass 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, … #> $ rush 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, … #> $ first_down NA, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,… #> $ special 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, … #> $ play 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, … #> $ passer_id NA, NA, \"00-0026143\", NA, \"00-002… #> $ rusher_id NA, NA, NA, \"00-0031285\", NA, NA,… #> $ receiver_id NA, NA, NA, NA, NA, NA, NA, \"00-0… #> $ name NA, NA, \"M.Ryan\", \"D.Freeman\", \"M… #> $ jersey_number NA, NA, 2, 24, 2, NA, 33, 8, 8, N… #> $ id NA, NA, \"00-0026143\", \"00-0031285… #> $ fantasy_player_name NA, NA, NA, \"D.Freeman\", \"M.Ryan\"… #> $ fantasy_player_id NA, NA, NA, \"00-0031285\", \"00-002… #> $ fantasy NA, NA, NA, \"D.Freeman\", \"M.Ryan\"… #> $ fantasy_id NA, NA, NA, \"00-0031285\", \"00-002… #> $ out_of_bounds 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, … #> $ home_opening_kickoff 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ qb_epa 0.00000000, 0.00000000, -1.658763… #> $ xyac_epa NA, NA, NA, NA, NA, NA, NA, 0.747… #> $ xyac_mean_yardage NA, NA, NA, NA, NA, NA, NA, 6.732… #> $ xyac_median_yardage NA, NA, NA, NA, NA, NA, NA, 6, 0,… #> $ xyac_success NA, NA, NA, NA, NA, NA, NA, 0.505… #> $ xyac_fd NA, NA, NA, NA, NA, NA, NA, 0.053… #> $ xpass NA, NA, 0.4867992, 0.6399938, 0.9… #> $ pass_oe NA, NA, 51.320082, -63.999379, 6.… # }"},{"path":"https://www.nflfastr.com/reference/load_player_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Load Player Level Weekly Stats — load_player_stats","title":"Load Player Level Weekly Stats — load_player_stats","text":"Load Player Level Weekly Stats","code":""},{"path":"https://www.nflfastr.com/reference/load_player_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load Player Level Weekly Stats — load_player_stats","text":"","code":"load_player_stats(...)"},{"path":"https://www.nflfastr.com/reference/load_player_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load Player Level Weekly Stats — load_player_stats","text":"... Arguments passed nflreadr::load_player_stats seasons numeric vector seasons return, defaults recent season. set TRUE, returns available data. stat_type one \"offense\", \"defense\", \"kicking\" file_type One c(\"rds\", \"qs\", \"csv\", \"parquet\"). Can also set globally options(nflreadr.prefer)","code":""},{"path":"https://www.nflfastr.com/reference/load_player_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load Player Level Weekly Stats — load_player_stats","text":"tibble week-level player statistics aims match NFL official box scores.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/load_player_stats.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Load Player Level Weekly Stats — load_player_stats","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems stats <- load_player_stats() dplyr::glimpse(stats) }) #> Warning: We have changed the behavior of `load_player_stats()` as of nflfastR 4.3.0. #> Calling it without an argument will return the current season only instead of #> all available seasons. #> Please try `load_player_stats(seasons = TRUE)` to get all seasons. #> This warning is displayed once every 8 hours. #> Rows: 5,653 #> Columns: 53 #> $ player_id \"00-0023459\", \"00-0024243\", \"00-0024243\", … #> $ player_name \"A.Rodgers\", \"M.Lewis\", \"M.Lewis\", \"M.Lewi… #> $ player_display_name \"Aaron Rodgers\", \"Marcedes Lewis\", \"Marced… #> $ position \"QB\", \"TE\", \"TE\", \"TE\", \"TE\", \"TE\", \"QB\", … #> $ position_group \"QB\", \"TE\", \"TE\", \"TE\", \"TE\", \"TE\", \"QB\", … #> $ headshot_url \"https://static.www.nfl.com/image/private/… #> $ recent_team \"NYJ\", \"CHI\", \"CHI\", \"CHI\", \"CHI\", \"CHI\", … #> $ season 2023, 2023, 2023, 2023, 2023, 2023, 2023, … #> $ week 1, 4, 7, 11, 14, 16, 13, 14, 15, 16, 17, 1… #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", … #> $ opponent_team \"BUF\", \"DEN\", \"LV\", \"DET\", \"DET\", \"ARI\", \"… #> $ completions 0, 0, 0, 0, 0, 0, 23, 26, 28, 27, 19, 34, … #> $ attempts 1, 0, 0, 0, 0, 0, 44, 45, 44, 42, 29, 46, … #> $ passing_yards 0, 0, 0, 0, 0, 0, 254, 311, 374, 368, 309,… #> $ passing_tds 0, 0, 0, 0, 0, 0, 2, 3, 2, 3, 3, 1, 0, 1, … #> $ interceptions 0, 0, 0, 0, 0, 0, 1, 1, 3, 2, 1, 2, 0, 2, … #> $ sacks 1, 0, 0, 0, 0, 0, 2, 1, 4, 0, 1, 4, 0, 1, … #> $ sack_yards 10, 0, 0, 0, 0, 0, 14, 4, 31, 0, 8, 39, 0,… #> $ sack_fumbles 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, … #> $ sack_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, … #> $ passing_air_yards 17, 0, 0, 0, 0, 0, 543, 334, 382, 472, 179… #> $ passing_yards_after_catch 0, 0, 0, 0, 0, 0, 70, 158, 158, 108, 184, … #> $ passing_first_downs 0, 0, 0, 0, 0, 0, 10, 11, 12, 18, 9, 14, 1… #> $ passing_epa -2.031960, NA, NA, NA, NA, NA, -7.791564, … #> $ passing_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, … #> $ pacr 0.0000000, NA, NA, NA, NA, NA, 0.4677716, … #> $ dakota NA, NA, NA, NA, NA, NA, -0.024772334, 0.00… #> $ carries 0, 0, 0, 0, 0, 0, 0, 4, 1, 2, 2, 3, 3, 4, … #> $ rushing_yards 0, 0, 0, 0, 0, 0, 0, -1, -1, 1, 3, 13, 11,… #> $ rushing_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ rushing_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, … #> $ rushing_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ rushing_first_downs 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 2, 1, 1, … #> $ rushing_epa NA, NA, NA, NA, NA, NA, NA, -0.2038061, -0… #> $ rushing_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receptions 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ targets 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_yards 0, 8, 16, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ receiving_tds 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_air_yards 0, -3, 5, 9, -3, 1, 0, 0, 0, 0, 0, 0, 0, 0… #> $ receiving_yards_after_catch 0, 11, 11, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ receiving_first_downs 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_epa NA, 0.4834648, 1.4372238, -0.5473667, -0.1… #> $ receiving_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ racr NA, 0.0, 3.2, 0.0, 0.0, 1.0, NA, NA, NA, N… #> $ target_share NA, 0.03125000, 0.03448276, 0.04545455, 0.… #> $ air_yards_share NA, -0.012396694, 0.094339623, 0.036885246… #> $ wopr NA, 0.03819731, 0.11776187, 0.09400149, 0.… #> $ special_teams_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ fantasy_points 0.00, 0.80, 1.60, 0.00, 0.40, 6.10, 16.16,… #> $ fantasy_points_ppr 0.00, 1.80, 2.60, 0.00, 1.40, 7.10, 16.16,… # }"},{"path":"https://www.nflfastr.com/reference/missing_raw_pbp.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","title":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","text":"Uses nflreadr::load_schedules() load game IDs finished games compares IDs files saved dir. function intended serve input save_raw_pbp().","code":""},{"path":"https://www.nflfastr.com/reference/missing_raw_pbp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","text":"","code":"missing_raw_pbp( dir = getOption(\"nflfastR.raw_directory\", default = NULL), seasons = TRUE, verbose = TRUE )"},{"path":"https://www.nflfastr.com/reference/missing_raw_pbp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","text":"dir Path local directory (defaults option \"nflfastR.raw_directory\"). nflfastR download raw game files split season one sub directory per season. seasons numeric vector seasons return, default TRUE returns available data. verbose TRUE, print number missing game files well oldest recent missing ID console.","code":""},{"path":"https://www.nflfastr.com/reference/missing_raw_pbp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","text":"character vector missing game IDs. files missing, returns NULL invisibly.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/missing_raw_pbp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","text":"","code":"# \\donttest{ try( missing <- missing_raw_pbp(tempdir()) ) #> ℹ You are missing 6706 game files. The oldest missing game is \"1999_01_MIN_ATL\". The most recent missing game is \"2023_22_SF_KC\". # }"},{"path":"https://www.nflfastr.com/reference/nflfastR-package.html","id":null,"dir":"Reference","previous_headings":"","what":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","title":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","text":"set functions access National Football League play--play data https://www.nfl.com/.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/nflfastR-package.html","id":"preface","dir":"Reference","previous_headings":"","what":"Preface","title":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","text":"Prior nflfastR v4.0, parallel processing activated argument pp relevant functions progress updates always shown. methods bad practice therefore removed nflfastR v4.0 next sections describe make nflfastR work parallel processes show progress updates user wants .","code":""},{"path":"https://www.nflfastr.com/reference/nflfastR-package.html","id":"more-speed-using-parallel-processing","dir":"Reference","previous_headings":"","what":"More Speed Using Parallel Processing","title":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","text":"Nearly nflfastR functions support parallel processing using furrr::future_map() enabled call future::plan() prior function call. Please see documentation functions detailed information. example, following code block resolve function calls current session using multiple sessions background load play--play data 2018 2020 seasons build freshly 2018 2019 Super Bowls: recommend choosing default parallel processing method saving environment variable R user profile make sure futures resolved chosen method default. can done following given steps. First, run following line file .Renviron opened automatically. saved environment variables yet, empty file. opened file .Renviron add next line, save file restart R session. Please note example sets \"multisession\" default. users appropriate plan please make sure truly . session freshly restarted please check method worked running next line. output FALSE successfully set default non-sequential future::plan(). output TRUE functions behave like called purrr::map() multisession. information possible plans please see future package Readme. information .Renviron please see book chapter.","code":"future::plan(\"multisession\") load_pbp(2018:2020) build_nflfastR_pbp(c(\"2018_21_NE_LA\", \"2019_21_SF_KC\")) usethis::edit_r_environ() R_FUTURE_PLAN=\"multisession\" inherits(future::plan(), \"sequential\")"},{"path":"https://www.nflfastr.com/reference/nflfastR-package.html","id":"get-progress-updates-while-functions-are-running","dir":"Reference","previous_headings":"","what":"Get Progress Updates while Functions are Running","title":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","text":"nflfastR functions able show progress updates using progressr::progressor() turned function called. least two basic ways either activating progress updates globally (current session) piping function call progressr::with_progress(): Just like previous section, possible activate global progression handlers default. can done following given steps. First, run following line file .Rprofile opened automatically. saved code yet, empty file. opened file .Rprofile add next line, save file restart R session. code file executed new R session starts. part (require(\"progressr\")) makes sure run package progressr installed avoid crashing R sessions. session freshly restarted please check method worked running next line. output TRUE successfully activated global progression handlers sessions. information work progress handlers please see progressr::progressr. information .Rprofile please see book chapter.","code":"progressr::handlers(global = TRUE) load_pbp(2018:2020) %>% progressr::with_progress() usethis::edit_r_profile() if (requireNamespace(\"progressr\", quietly = TRUE)) progressr::handlers(global = TRUE) progressr::handlers(global = NA)"},{"path":[]},{"path":"https://www.nflfastr.com/reference/nflfastR-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","text":"Maintainer: Ben Baldwin bbaldwin206@gmail.com Authors: Sebastian Carl mrcaseb@gmail.com contributors: Lee Sharpe [contributor] Maksim Horowitz maksim.horowitz@gmail.com [contributor] Ron Yurko ryurko@stat.cmu.edu [contributor] Samuel Ventura samventura22@gmail.com [contributor] Tan Ho [contributor] John Edwards edwards1860@gmail.com [contributor]","code":""},{"path":"https://www.nflfastr.com/reference/report.html","id":null,"dir":"Reference","previous_headings":"","what":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","title":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","text":"function gives quick overview versions R operating system well versions nflverse packages, options, dependencies. primarily designed help get quick idea going helping someone else debug problem.","code":""},{"path":"https://www.nflfastr.com/reference/report.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","text":"","code":"report(...)"},{"path":"https://www.nflfastr.com/reference/report.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","text":"... Arguments passed nflreadr::nflverse_sitrep pkg character vector naming installed packages, NULL (default) meaning nflverse packages. function checks internally packages installed informs case. recursive logical indicating whether dependencies pkg dependencies () included. Can also character vector listing types dependencies, subset c(\"Depends\", \"Imports\", \"LinkingTo\", \"Suggests\", \"Enhances\"). Character string \"\" shorthand vector, character string \"\" vector without \"Enhances\", character string \"strong\" (default) first three elements vector. redact_path logical indicating whether options contain \"path\" name redacted, default = TRUE","code":""},{"path":"https://www.nflfastr.com/reference/report.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","text":"See nflreadr::nflverse_sitrep details.","code":""},{"path":"https://www.nflfastr.com/reference/report.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","text":"","code":"# \\donttest{ # \\dontshow{ # set CRAN mirror to avoid failing checks in weird scenarios old_ops <- options(repos = c(\"CRAN\" = \"https://cran.rstudio.com/\")) # } report(recursive = FALSE) #> ── System Info ───────────────────────────────────────────────────────────────── #> • R version 4.3.3 (2024-02-29) • Running under: Ubuntu 22.04.4 LTS #> ── Package Status ────────────────────────────────────────────────────────────── #> package installed cran dev behind #> 1 nflfastR 4.6.1.9007 4.6.1 4.6.1.9007 #> 2 nflplotR 1.3.0 1.3.0 1.3.0 #> 3 nflreadr 1.4.0.11 1.4.0 1.4.0.11 #> 4 nflseedR 1.2.0 1.2.0 1.2.0.9000 dev #> ── Package Options ───────────────────────────────────────────────────────────── #> • No options set for above packages #> ── Not Installed ─────────────────────────────────────────────────────────────── #> • nfl4th () #> • nflverse () #> ──────────────────────────────────────────────────────────────────────────────── nflverse_sitrep(pkg = \"nflreadr\", recursive = TRUE) #> ── System Info ───────────────────────────────────────────────────────────────── #> • R version 4.3.3 (2024-02-29) • Running under: Ubuntu 22.04.4 LTS #> ── Package Status ────────────────────────────────────────────────────────────── #> package installed cran dev behind #> 1 nflreadr 1.4.0.11 1.4.0 1.4.0.11 #> ── Package Options ───────────────────────────────────────────────────────────── #> • No options set for above packages #> ── Package Dependencies ──────────────────────────────────────────────────────── #> • cachem (1.0.8) • glue (1.7.0) • graphics (4.3.3) #> • cli (3.6.2) • memoise (2.0.1) • methods (4.3.3) #> • curl (5.2.1) • rappdirs (0.3.3) • stats (4.3.3) #> • data.table (1.15.2) • rlang (1.1.3) • tools (4.3.3) #> • fastmap (1.1.1) • grDevices (4.3.3) • utils (4.3.3) #> ──────────────────────────────────────────────────────────────────────────────── # \\dontshow{ # restore old options options(old_ops) # } # }"},{"path":"https://www.nflfastr.com/reference/save_raw_pbp.html","id":null,"dir":"Reference","previous_headings":"","what":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","title":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","text":"functions build_nflfastR_pbp() fast_scraper() support loading raw pbp data local file systems instead Github servers. function intended help setting . loads raw pbp data saves given directory split season subdirectories.","code":""},{"path":"https://www.nflfastr.com/reference/save_raw_pbp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","text":"","code":"save_raw_pbp( game_ids, dir = getOption(\"nflfastR.raw_directory\", default = NULL) )"},{"path":"https://www.nflfastr.com/reference/save_raw_pbp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","text":"game_ids vector nflverse game IDs. dir Path local directory (defaults option \"nflfastR.raw_directory\"). nflfastR download raw game files split season one sub directory per season.","code":""},{"path":"https://www.nflfastr.com/reference/save_raw_pbp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","text":"function returns data frame one row downloaded file following columns: success HTTP request successfully performed, regardless response status code. FALSE case network error, case tried resume server support . value NA means download interrupted progress. status_code HTTP status code request. successful download usually 200 full requests 206 resumed requests. Anything else indicate downloaded file contains error page instead requested content. resumefrom file size request, case download resumed. url final url (redirects) request. destfile downloaded file disk. error success == FALSE column contains error message. type Content-Type response header value. modified Last-Modified response header value. time total elapsed download time file seconds. headers vector http response headers request.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/save_raw_pbp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","text":"","code":"# \\donttest{ # CREATE LOCAL TEMP DIRECTORY local_dir <- tempdir() # LOAD AND SAVE A GAME TO TEMP DIRECTORY save_raw_pbp(\"2021_20_BUF_KC\", dir = local_dir) #> # A tibble: 1 × 10 #> success status_code resumefrom url destfile error type modified #> #> 1 TRUE 200 0 https… /tmp/Rt… NA appl… NA #> # ℹ 2 more variables: time , headers # REMOVE THE DIRECTORY unlink(file.path(local_dir, 2021)) # }"},{"path":"https://www.nflfastr.com/reference/stat_ids.html","id":null,"dir":"Reference","previous_headings":"","what":"NFL Stat IDs and their Meanings — stat_ids","title":"NFL Stat IDs and their Meanings — stat_ids","text":"NFL Stat IDs Meanings","code":""},{"path":"https://www.nflfastr.com/reference/stat_ids.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"NFL Stat IDs and their Meanings — stat_ids","text":"","code":"stat_ids"},{"path":"https://www.nflfastr.com/reference/stat_ids.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"NFL Stat IDs and their Meanings — stat_ids","text":"data frame including NFL stat IDs, names descriptions used nflfastR dataset.","code":""},{"path":"https://www.nflfastr.com/reference/stat_ids.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"NFL Stat IDs and their Meanings — stat_ids","text":"http://www.nflgsis.com/gsis/Documentation/Partners/StatIDs.html","code":""},{"path":"https://www.nflfastr.com/reference/stat_ids.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"NFL Stat IDs and their Meanings — stat_ids","text":"","code":"# \\donttest{ stat_ids #> # A tibble: 112 × 3 #> stat_id name comment #> #> 1 1 Rushing Yards - Minus \"Used in addition to the other Rushing st… #> 2 2 Punt Blocked (Offense) \"Punt was blocked. A blocked punt is a pu… #> 3 3 1st Down Rushing \"A first down or TD occurred due to a rus… #> 4 4 1st Down Passing \"A first down or TD occurred due to a pas… #> 5 5 1st Down Penalty \"A first down or TD occurred due to a pen… #> 6 6 3rd Down Attempt Converted \"3rd down play resulted in a first down o… #> 7 7 3rd Down Attempt Failed \"3rd down play did NOT result in a first … #> 8 8 4th Down Attempt Converted \"4th down play resulted in a first down o… #> 9 9 4th Down Attempt Failed \"4th down play did NOT result in a first … #> 10 10 Rushing Yards \"Rushing yards and credit for a rushing a… #> # ℹ 102 more rows # }"},{"path":"https://www.nflfastr.com/reference/teams_colors_logos.html","id":null,"dir":"Reference","previous_headings":"","what":"NFL Team names, colors and logo urls. — teams_colors_logos","title":"NFL Team names, colors and logo urls. — teams_colors_logos","text":"NFL Team names, colors logo urls.","code":""},{"path":"https://www.nflfastr.com/reference/teams_colors_logos.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"NFL Team names, colors and logo urls. — teams_colors_logos","text":"","code":"teams_colors_logos"},{"path":"https://www.nflfastr.com/reference/teams_colors_logos.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"NFL Team names, colors and logo urls. — teams_colors_logos","text":"data frame 36 rows 10 variables containing NFL team level information, including franchises multiple cities: team_abbr Team abbreviation team_name Complete Team name team_id Team id used roster function team_nick Nickname team_conf Conference team_division Division team_color Primary color team_color2 Secondary color team_color3 Tertiary color team_color4 Quaternary color team_logo_wikipedia Url Team logo wikipedia team_logo_espn Url higher quality logo espn team_wordmark Url team wordmarks team_conference_logo Url AFC NFC logos team_league_logo Url NFL logo primary secondary colors taken nfl.com modifications better team distinction recent team color themes. tertiary quaternary colors taken Lee Sharpe's teamcolors.csv taken teamcolors package created Ben Baumer Gregory Matthews. Wikipeadia logo urls taken Lee Sharpe's logos.csv Team wordmarks nfl.com","code":""},{"path":"https://www.nflfastr.com/reference/teams_colors_logos.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"NFL Team names, colors and logo urls. — teams_colors_logos","text":"","code":"# \\donttest{ teams_colors_logos #> # A tibble: 36 × 15 #> team_abbr team_name team_id team_nick team_conf team_division team_color #> #> 1 ARI Arizona Cardi… 3800 Cardinals NFC NFC West #97233F #> 2 ATL Atlanta Falco… 0200 Falcons NFC NFC South #A71930 #> 3 BAL Baltimore Rav… 0325 Ravens AFC AFC North #241773 #> 4 BUF Buffalo Bills 0610 Bills AFC AFC East #00338D #> 5 CAR Carolina Pant… 0750 Panthers NFC NFC South #0085CA #> 6 CHI Chicago Bears 0810 Bears NFC NFC North #0B162A #> 7 CIN Cincinnati Be… 0920 Bengals AFC AFC North #FB4F14 #> 8 CLE Cleveland Bro… 1050 Browns AFC AFC North #FF3C00 #> 9 DAL Dallas Cowboys 1200 Cowboys NFC NFC East #002244 #> 10 DEN Denver Broncos 1400 Broncos AFC AFC West #002244 #> # ℹ 26 more rows #> # ℹ 8 more variables: team_color2 , team_color3 , team_color4 , #> # team_logo_wikipedia , team_logo_espn , team_wordmark , #> # team_conference_logo , team_league_logo # }"},{"path":"https://www.nflfastr.com/reference/update_db.html","id":null,"dir":"Reference","previous_headings":"","what":"Update or Create a nflfastR Play-by-Play Database — update_db","title":"Update or Create a nflfastR Play-by-Play Database — update_db","text":"update_db updates creates database nflfastR play play data completed games since 1999.","code":""},{"path":"https://www.nflfastr.com/reference/update_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update or Create a nflfastR Play-by-Play Database — update_db","text":"","code":"update_db( dbdir = getOption(\"nflfastR.dbdirectory\", default = \".\"), dbname = \"pbp_db\", tblname = \"nflfastR_pbp\", force_rebuild = FALSE, db_connection = NULL )"},{"path":"https://www.nflfastr.com/reference/update_db.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update or Create a nflfastR Play-by-Play Database — update_db","text":"dbdir Directory database shall located. Can also set globally options(nflfastR.dbdirectory) dbname File name existing desired SQLite database within dbdir tblname name play play data table within database force_rebuild Hybrid parameter (logical numeric) rebuild parts complete play play data table within database (please see details information) db_connection DBIConnection object, returned DBI::dbConnect() (please see details information)","code":""},{"path":"https://www.nflfastr.com/reference/update_db.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Update or Create a nflfastR Play-by-Play Database — update_db","text":"function creates updates data table name tblname within SQLite database (drivers via db_connection) located dbdir named dbname. data table combines play play data every available game back 1999 season adds recent completed games soon available nflfastR. argument force_rebuild hybrid type. can rebuild play play data table either whole nflfastR era (force_rebuild = TRUE) just specified seasons (e.g. force_rebuild = c(2019, 2020)). Please note following behavior: force_rebuild = TRUE: data table name tblname removed completely rebuilt scratch. helpful new columns added -Season. force_rebuild = c(2019, 2020): data table name tblname preserved rows 2019 2020 seasons deleted re-added. intended used ongoing seasons NFL fixes bugs underlying data week recommend rebuilding current season every Thursday season. parameter db_connection intended advanced users want use DBI drivers, MariaDB, Postgres odbc. Please note arguments dbdir dbname dropped case db_connection provided argument tblname still used write data table database.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-development-version","dir":"Changelog","previous_headings":"","what":"nflfastR (development version)","title":"nflfastR (development version)","text":"Drop crayon, DT, httr, jsonlite, qs dependencies. (#453) function calculate_player_stats_def now returns season_type argument weekly set TRUE consistency player stats functions. (#455) function missing_raw_pbp() now allows filtering season. (#457) robust handling player IDs decode_player_ids(). (#458) Fixed rare cases value yrdln variable didn’t equal \"MID 50\" midfield. (#459) Fixed rare cases drive_start_yard_line missed blank space team name yard line number. (#459) Fixed play description 1999 2000 games string “D.Holland” replaced kick distance. (#459) Fixed problem goal_to_go variable FALSE actual goal go situations. (#460) Fixed bug fixed_drive fixed_drive_result second weather delay 2023_13_ARI_PIT wasn’t identified correctly. (#461)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-461","dir":"Changelog","previous_headings":"","what":"nflfastR 4.6.1","title":"nflfastR 4.6.1","text":"CRAN release: 2024-01-09 function calculate_series_conversion_rates() now correctly aggregates season level conversion rates. Performance also improved. (#440) Adjusted test behavior CRAN’s request. Thank @andrewtek, @gregalvi86, @Ic4ru5Wing, @JoeMarino2021, @jreddy1990, @marvin3FF, @mrcaseb, @RicShern, @SPNE, @trivialfis questions, feedback, contributions towards release.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-460","dir":"Changelog","previous_headings":"","what":"nflfastR 4.6.0","title":"nflfastR 4.6.0","text":"CRAN release: 2023-10-20","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-features-4-6-0","dir":"Changelog","previous_headings":"","what":"New Features","title":"nflfastR 4.6.0","text":"nflfastR now fully supports loading raw pbp data local file system. best way use feature set options(\"nflfastR.raw_directory\" = {\"/local/directory\"}). Alternatively, build_nflfastR_pbp() fast_scraper() support argument dir defaults option. (#423) Added new function save_raw_pbp() efficiently downloads raw play--play data saves local file system. serves helper setup system faster play--play parsing via functionality. (#423) Added new function missing_raw_pbp() computes vector game IDs missing local raw play--play directory. (#423)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-bugfixes-4-6-0","dir":"Changelog","previous_headings":"","what":"Minor Improvements and Bugfixes","title":"nflfastR 4.6.0","text":"internal function get_pbp_nfl() now uses ifelse() instead dplyr::if_else() handle null-checking, fixes bug found 2022_21_CIN_KC match. function calculate_player_stats() now summarises target share air yards share correctly called argument weekly = FALSE (#413) function calculate_player_stats() now returns opponent team called argument weekly = TRUE (#414) function calculate_player_stats_def() longer errors small subsets pbp data missing stats. (#415) function calculate_series_conversion_rates() longer returns NA values small subset pbp data missing series offense defense. (#417) fixed_drive now correctly increments plays posteam lost fumble remains posteam defteam also lost fumble play. (#419) nflfastR now fixes missing drive number counts raw pbp data order provide accurate drive information. (#420) nflfastR now returns correct kick_distance punts kickoffs. (#422) Decode player IDs 2023 pbp. (#425) Drop pseudo plays TV Timeout Two-Minute Warning. (#426) Fix posteam kickoffs PATs following defensive TD 2023+ pbp. (#427) calculate_player_stats() counts lost fumbles plays player fumbles, team mate recovers loses fumble defense. (#431) variables passer, receiver, rusher return NA “abnormal” plays - like direct snaps, aborted snaps, laterals etc. - resulted penalty. (#435) Thank @903124, @ak47twq, @andrewtek, @darkhark, @dennisbrookner, @marvin3FF, @mistakia, @mrcaseb, @nicholasmendoza22, @rickstarblazer, @RileyJohnson22, @tanho63 questions, feedback, contributions towards release.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-451","dir":"Changelog","previous_headings":"","what":"nflfastR 4.5.1","title":"nflfastR 4.5.1","text":"CRAN release: 2022-12-22 New implementation tests able identify breaking changes reverse dependencies (#396, #406) calculate_standings() freezes computing standings schedules games missing results, .e. upcoming games. Bug fix caused problems upcoming dplyr tidyselect updates weren’t reverse compatible. Significant performance improvements internal functions. (#402) Wrap examples try() avoid CRAN problems. (#404) Fixed bug calculate_standings() wasn’t able handle nflverse pbp data. (#404)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-450","dir":"Changelog","previous_headings":"","what":"nflfastR 4.5.0","title":"nflfastR 4.5.0","text":"CRAN release: 2022-11-05","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-experimental-functions-4-5-0","dir":"Changelog","previous_headings":"","what":"New (experimental) functions","title":"nflfastR 4.5.0","text":"Added new function calculate_player_stats_def() aggregates defensive player stats either game level overall. (#288) situation report nflverse_sitrep alias already available report() Added new function calculate_player_stats_kicking() aggregates player stats field goals extra points game level overall. (#381) Added new function calculate_series_conversion_rates() computes series conversion series result rates game level season level. (#393)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"bugfixes-and-minor-improvements-4-5-0","dir":"Changelog","previous_headings":"","what":"Bugfixes and Minor Improvements","title":"nflfastR 4.5.0","text":"Internal change calculate_player_stats() reflects new nflverse data infrastructure. player_display_name - Full name player position - Position player position_group - Position group player headshot_url - URL player headshot image Make data work 2022 (hopefully) Fix Amon-Ra St. Brown breaking name parser Add gsis_id patch clean_pbp(). calculate_player_stats_def() failed situations play--play data missing certain stats. (#382) Spot-fixing calculate_player_stats() NA names.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-440","dir":"Changelog","previous_headings":"","what":"nflfastR 4.4.0","title":"nflfastR 4.4.0","text":"CRAN release: 2022-08-06","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-functions-options-data-4-4-0","dir":"Changelog","previous_headings":"","what":"New Functions, Options, Data","title":"nflfastR 4.4.0","text":"Added new function calculate_standings() computes regular season division standings playoff seeds nflverse data. database function update_db() now supports option “nflfastR.dbdirectory” can used set directory nflfastR pbp database globally independent project structure working directories. embedded data frame ?teams_colors_logos updated reflect recent team color themes gained additional variables conference division well logo urls conference league logos. (#290) embedded data frame ?teams_colors_logos updated Washington Commanders. (#312)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"deprecation-4-4-0","dir":"Changelog","previous_headings":"","what":"Deprecation","title":"nflfastR 4.4.0","text":"argument qs functions load_pbp() load_player_stats() deprecated nflfastR 4.3.0. release removes argument entirely.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"bugfixes-and-minor-improvements-4-4-0","dir":"Changelog","previous_headings":"","what":"Bugfixes and Minor Improvements","title":"nflfastR 4.4.0","text":"Fixed bug player duplicated calculate_player_stats() rare cases caused plays laterals. (#289) Fixed bug function add_xpass() failed called empty data frame. (#296) Fixed bug play_type showed no_play plays penalties don’t result replay . (#277, #281) Fixed bug variable descriptions total_home_score total_away_score. (#300) fast_scraper_rosters() fast_scraper_schedules() now call nflreadr::load_rosters() nflreadr::load_schedules() hood (#304) Fixed bug causing missing EPA game-ending turnovers overtime Bump minimum nflreadr version 1.2.0 data repository change Fix bug affecting yardline small number plays 2000 season (#323) update_db() now uses default play predefine column types db drivers. (#324) Fix bug resulted incorrect xyac_mean_yardage 4th downs (#327) Fix bug resulted missing xyac information plays involving J.O’Shaughnessy (#329) Fix bug resulted missing epa last play games involving NE BUF (#331) fast_scraper() build_nflfastR_pbp() now return data frames class nflverse_data consistent nflreadr. Fix behavior EP model neutral site games (treats teams away teams)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-430","dir":"Changelog","previous_headings":"","what":"nflfastR 4.3.0","title":"nflfastR 4.3.0","text":"CRAN release: 2021-10-06","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-changes-4-3-0","dir":"Changelog","previous_headings":"","what":"Minor Changes","title":"nflfastR 4.3.0","text":"Add nflreadr dependecies drop lubridate magrittr dependency functions load_pbp() load_player_stats() now call nflreadr::load_pbp() nflreadr::load_player_stats() respectively. Therefore argument qs deprecated functions. removed future release. Running load_player_stats() without argument now return player stats current season (default nflreadr). deprecated arguments source pp functions fast_scraper_*() build_nflfastR_pbp() removed Added variables racr (“Receiver Air Conversion Ratio”), target_share, air_yards_share, wopr (“Weighted Opportunity Rating”) pacr (“Passing Air Conversion Ratio”) output calculate_player_stats() Added function report() used maintainers help users debug problems (#274).","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"bug-fixes-4-3-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"nflfastR 4.3.0","text":"Fixed minor bug console output update_db() Fix handful missing receiver names (#270) Fixed bug missing return_team interception return touchdowns (#275) Fixed rare bug internal object wasn’t predefined (#272)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-420","dir":"Changelog","previous_headings":"","what":"nflfastR 4.2.0","title":"nflfastR 4.2.0","text":"CRAN release: 2021-08-03 wpa variables NA end game line wp variables 0, 0.5, 1, NA end game line Fix bug win prob PATs assumed PAT placed 15 yard line, even older seasons function decode_player_ids() now really decodes new variable fantasy_id (#229) Fixed bug caused slightly differing wp values depending first game data set (#183) Edited GitHub references point nflverse Added variables sack_yards, sack_fumbles, rushing_fumbles receiving_fumbles output function calculate_player_stats(), thanks Mike Filicicchia (@TheMathNinja). (#239) Fixed bug calculate_player_stats() falsely counted lost fumbles aborted snaps (#238) Added variable season_type output calculate_player_stats() load_player_stats() preparation extended Regular Season starting 2021 (#240) Updated season_type definitions preparation extended Regular Season starting 2021 (#242) Fix fixed_drive wasn’t incrementing muffed punt followed timeout (#244) Fix fixed_drive wasn’t incrementing following interception intercepting player losing fumble (#247) Fix issues missing play info 2018_01_ATL_PHI (#246) Added variables safety_player_name safety_player_id play--play data (#252) Dropped dependency usethis","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-410","dir":"Changelog","previous_headings":"","what":"nflfastR 4.1.0","title":"nflfastR 4.1.0","text":"CRAN release: 2021-03-23","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"functions-4-1-0","dir":"Changelog","previous_headings":"Breaking changes","what":"Functions","title":"nflfastR 4.1.0","text":"Added function calculate_player_stats() aggregates official passing, rushing, receiving stats either game level overall Added function load_player_stats() loads weekly player stats 1999 recent season performance functions add_xyac() clean_pbp() significantly improved","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-variables-4-1-0","dir":"Changelog","previous_headings":"Breaking changes","what":"New Variables","title":"nflfastR 4.1.0","text":"Added new columns td_player_name td_player_id clearly identify player scored touchdown (especially helpful plays multiple fumbles laterals resulting touchdown) function calculate_player_stats() now adds variable dakota, epa + cpoe composite, players minimum 5 pass attempts. Added column home_opening_kickoff clean_pbp() Added variables sack_player_id, sack_player_name, half_sack_1_player_id, half_sack_1_player_name, half_sack_2_player_id half_sack_2_player_name identify players recorded sacks (half sacks). Also updated description variables qb_hit_1_player_id, qb_hit_1_player_name, qb_hit_2_player_id qb_hit_2_player_name make clear record sack. (#180)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-fixes-4-1-0","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"nflfastR 4.1.0","text":"variable qb_scramble incomplete 2005 season missing scramble indicators play description. mostly fixed courtesy charting data Football Outsiders (thanks Aaron Schatz!). notes fix: Weeks 1-16 based charting. Weeks 17-21 guesses (basically every QB run except ) loss, b) gain, c) 3/4 1-2 go). Plays nullified penalty included. Change name, id, rusher, rusher_id player charged fumble aborted snaps QB unable make play (.e. pass, sack, scramble) (#162) function clean_pbp() now standardizes team name columns tackle_with_assist_*_team Fix bug drive causing incorrect overtime win probabilities (#194) Fixed bug posteam NA end quarter 2 (end quarter 4 overtime games) causing wrong values fixed_drive, fixed_drive_result, series series_result Fixed bug fixed_drive series falsely incrementing kickoffs recovered kicking team defensive touchdowns followed timeouts Fixed bug fixed_drive series falsely incrementing muffed punts recovered punting team touchdown Fixed bug add_xpass() crashed ran data already including xpass variables. Fixed bug epa safety scored team beginning play possession ball (#186) Fix bugs related David Duke Johnson Texans 2020 (#163) Fix yet another bug related correctly identifying possession team kickoffs nullified penalty (#199) Fixed bug calculate_player_stats() forgot clean player names using IDs Fixed bug special teams touchdowns missing output calculate_player_stats() (#203) Fixed old Jaguars games wrong team awarded points safeties kickoff return TDs (#209) function update_db() falsely closes database connection provided argument db_connection (#210) Fixed bug yards_gained missing yardage plays laterals. (#216) Fixed bug stats wrongly given play penalty (#218) fixed_drive now increments properly onside kick recoveries (#215) fixed_drive longer counts muffed kickoff one-play drive (#217) fixed_drive now properly increments safety (#219) Improved parser penalty_type updated description variable make clear ’s first penalty happened play. (#223)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-400","dir":"Changelog","previous_headings":"","what":"nflfastR 4.0.0","title":"nflfastR 4.0.0","text":"CRAN release: 2021-02-15","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"changed-functions-4-0-0","dir":"Changelog","previous_headings":"Breaking changes","what":"Changed Functions","title":"nflfastR 4.0.0","text":"Deprecated arguments source pp across package. Using cause warning. Parallel processing activated choosing appropriate future::plan() calling relevant functions. information please see package documentation. function build_nflfastR_pbp() now run decode_player_ids() default (can deactivated argument decode = FALSE). function build_nflfastR_pbp() now run add_xpass() default add new variables xpass pass_oe. functions fast_scraper() build_nflfastR_pbp() now allow output fast_scraper_schedules() directly input ’s necessary anymore pull game_id first.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-functions-and-variables-4-0-0","dir":"Changelog","previous_headings":"Breaking changes","what":"New Functions and Variables","title":"nflfastR 4.0.0","text":"Added new function load_pbp() loads complete seasons memory fast access play--play data. Added new variables rushing_yards, lateral_rushing_yards, passing_yards, receiving_yards, lateral_receiving_yards fix old bug yards_gained gets overwritten plays laterals (#115). Added columns vegas_wpa vegas_home_wpa contain Win Probability Added spread-adjusted WP model Added column out_of_bounds Added columns fantasy, fantasy_id, fantasy_player_name, fantasy_player_id indicate rusher receiver play Added columns tackle_with_assist, tackle_with_assist_1_player_id, tackle_with_assist_1_player_name, tackle_with_assist_1_team, tackle_with_assist_2_player_id, tackle_with_assist_2_player_name, tackle_with_assist_2_team","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"models-and-miscellaneous-4-0-0","dir":"Changelog","previous_headings":"Breaking changes","what":"Models and Miscellaneous","title":"nflfastR 4.0.0","text":"Tuned spread-adjusted win probability model one final (?) time. Expected points now longer required calculate_win_probability() Added field descriptions vignette(\"field_descriptions\") searchable list nflfastR variables Switched data source 2001-2010 used 2011 models moved fastrmodels package Added data frames ?field_descriptions ?stat_ids package","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-fixes-4-0-0","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"nflfastR 4.0.0","text":"Fix bug fixed_drive series weren’t updating muffed punt (#144) Fix bug induced fixing (#149) Fix bug special teams plays incorrectly labeled pass plays (#125) Fix bug points safeties given defteam instead posteam (#152) Fix bug muffed punt TD given wrong team 2011 Jaguars game (#154) Win probability now calculated prior PAT attempts rather using WP ensuing kickoff Improved performance internal functions speed rebuilding process update_db() (added qs curl dependencies) Fixed bug calculate_expected_points() calculate_win_probability() duplicated existing variables instead replacing (#170) Fixed bug penalty_type wasn’t \"no_play\" although (#172) Fixed bug penalty_team incorrect games Jaguars seasons 2011 - 2015 (#174) Fixed bug related calculation epa plays failed pass interference challenge 2019 games (#175) Fixed bug related lots fields NA offsetting penalties (#44) Fixed bug epa possession team changes end 1st 3rd quarter (#182) Fixed bug various functions left open connections vegas_wp now NA final line since possession team","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-320","dir":"Changelog","previous_headings":"","what":"nflfastR 3.2.0","title":"nflfastR 3.2.0","text":"CRAN release: 2020-11-20","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"models-3-2-0","dir":"Changelog","previous_headings":"","what":"Models","title":"nflfastR 3.2.0","text":"Performance update win probability model point spread (vegas_wp) Added yardline_100 input win probability models (included oversight)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-fixes-3-2-0","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"nflfastR 3.2.0","text":"Fixed bug series increased PATs Fixed bug affecting week 10 Raiders-Broncos game Added column team_wordmark - contains URLs team’s wordmarks - included data frame ?teams_colors_logos","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-311","dir":"Changelog","previous_headings":"","what":"nflfastR 3.1.1","title":"nflfastR 3.1.1","text":"CRAN release: 2020-10-22","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"database-function-update_db-3-1-1","dir":"Changelog","previous_headings":"New features","what":"Database Function update_db()","title":"nflfastR 3.1.1","text":"argument force_rebuild function update_db() now hybrid type. can rebuild play play data table either whole nflfastR era (force_rebuild = TRUE) just specified seasons (e.g. force_rebuild = 2019:2020). latter intended used running seasons NFL fixes bugs play play data week recommend rebuild current season every Thursday. Fixed bug update_db() disconnected connection database provided argument db_connection (#102) Fixed bug update_db() didn’t build fresh database without providing argument force_rebuild update_db() longer removes complete data table numeric argument force_rebuild passed removes rows within table (#109)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-functions-3-1-1","dir":"Changelog","previous_headings":"New features","what":"New Functions","title":"nflfastR 3.1.1","text":"Added new function build_nflfastR_pbp(), convenient wrapper around multiple nflfastR functions easy creation nflfastR play--play data set Added function applies experimental expected pass model, add_xpass(), creates columns xpass pass_oe","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-fixes-3-1-1","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"nflfastR 3.1.1","text":"fixes fixed_drive incrementing properly drives began following timeout Fixed bugs EPA win probability PATs kickoffs penalties Fixed bug scoring probabilities weren’t adding 1 field goal attempts near end half Messages user now created new dependency usethis Fixed bug plays “backward pass” play description counted pass plays (pass = 1) Fixed missing kick distance touchbacks blocked punts (#53) Added option fast (either TRUE FALSE) function decode_player_ids() activate high efficient C++ decoder package gsisdecoder","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-300","dir":"Changelog","previous_headings":"","what":"nflfastR 3.0.0","title":"nflfastR 3.0.0","text":"CRAN release: 2020-09-24","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"breaking-changes-3-0-0","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"nflfastR 3.0.0","text":"fast_scraper_roster() finally back! loads NFL roster given season. Added function decode_player_ids() decode player IDs commonly known GSIS ID format (00-00xxxxx)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-features-3-0-0","dir":"Changelog","previous_headings":"","what":"New features","title":"nflfastR 3.0.0","text":"Add option source = \"old\" fast_scraper() enable scraping old source. mostly useless doesn’t work 2020 provides less info Added new option db_connection update_db() allow advanced users use DBI drivers, RMariaDB::MariaDB(), RPostgres::Postgres() odbc::odbc() (please see dbplyr information)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-fixes-3-0-0","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"nflfastR 3.0.0","text":"clean_pbp() now fixes bugs jersey numbers clean_pbp(), add_qb_epa() add_xyac() can now handle empty data frames Fix empty line causing fast_scraper() fail (affects multiple games 2020 season) Fix bug fixed_drive counted PAT defensive TD drive Fixed bug caused high number tackles special cases Fixed bug CPOE NA targeting players apostrophe last name","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-221","dir":"Changelog","previous_headings":"","what":"nflfastR 2.2.1","title":"nflfastR 2.2.1","text":"CRAN release: 2020-09-01 Fix add_xyac() breaking old packages Fix add_xyac() add_qb_epa() calculations wrong failed 4th downs Updated Readme ep cp model plots Updated vignette(\"examples\") new add_xyac() function Added xYAC model vignette(\"nflfastR-models\") Added variables fixed_drive fixed_drive_result output fast_scraper() NFL-provided drive info extremely buggy Added variable series_result clean_pbp() now adds 4 new variables passer_jersey_number, rusher_jersey_number, receiver_jersey_number jersey_number. can used join rosters. Fixed incorrect timeout_team, return_team, fumble_recovery_1_team JAX games 2011-2015 Re-trained EPA model fixed_drive corrections timeout_team","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-220","dir":"Changelog","previous_headings":"","what":"nflfastR 2.2.0","title":"nflfastR 2.2.0","text":"New function add_xyac() adds following columns associated expected yards catch (xYAC): xyac_epa, xyac_success, xyac_fd, xyac_mean_yardage, xyac_median_yardage","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-213","dir":"Changelog","previous_headings":"","what":"nflfastR 2.1.3","title":"nflfastR 2.1.3","text":"Fixed bug series_success caused bad drive information provided NFL","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-212","dir":"Changelog","previous_headings":"","what":"nflfastR 2.1.2","title":"nflfastR 2.1.2","text":"Added following columns available 2011 later: special_teams_play, st_play_type, time_of_day, order_sequence Added old_game_id column (useful merging external data still uses ID: format YYYYMMDDxx) clean_pbp() function now adds aborted_play column Fixed bug pass plays penalty end play classified play_type = no_play rather pass Fixed bug EPA defensive 2 point return -0.95 instead -2.95 Fixed remaining failed challenge plays incorrectly 0 EPA Updated included dataframe teams_colors_logos interim name ‘Washington Football Team’ corresponding logo urls. internal code improvements causing required tidyselect version >= 1.1.0","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"functions-2-1-1","dir":"Changelog","previous_headings":"","what":"Functions","title":"nflfastR 2.1.1","text":"players whose careers finished 2011, IDs remain players played eras new era, ID new ID example, Akili Smith (ID: 00-0015082) Alex Smith (ID: 32013030-2d30-3032-3334-3336b638d37d) abbreviated “.Smith” can distinguished IDs, Akili showing old format ID looks like, Smith new one Standardization realized using ID map available data repo clean_pbp() now removes variables create make sure nothing unexpected can happen","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"miscellaneous-2-1-1","dir":"Changelog","previous_headings":"","what":"Miscellaneous","title":"nflfastR 2.1.1","text":"Added minimum version requirements package dependencies installation broke users outdated packages Made minor bug fix catch --order plays fixed bug plays incorrectly dropped older seasons Standardized team names (e.g. SD –> LAC) columns missed","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"models-2-1-0","dir":"Changelog","previous_headings":"","what":"Models","title":"nflfastR 2.1.0","text":"Removed week Expected Points models along update vignette(\"nflfastR-models\") vignette(\"examples\")","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"functions-2-1-0","dir":"Changelog","previous_headings":"","what":"Functions","title":"nflfastR 2.1.0","text":"Added function update_db() adds completed games SQLite database Added function calculate_win_probability() Added new examples vignette(\"examples\") demonstrating usage mentioned functions","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"bugs-2-1-0","dir":"Changelog","previous_headings":"","what":"Bugs","title":"nflfastR 2.1.0","text":"Fixed problem inconsistent data types variable drive_real_start_time pre post 2011 Fixed problem game_ids overwritten play play parsing Fix WP bugs kickoffs penalties rare play description","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"miscellaneous-2-1-0","dir":"Changelog","previous_headings":"","what":"Miscellaneous","title":"nflfastR 2.1.0","text":"fast_scraper() now loads raw game data separate raw data repo Completely overhauled entire code base directly implement tidy evaluation using .data rlang package (major code change takes getting used need preparation future release)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-206","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.6","title":"nflfastR 2.0.6","text":"Fixed problem defensive two point conversions counted Kneels kickoffs longer counted qb kneels Variable yards_gained precisely defined Bugfixes games order plays Fix bug related EPA plays failed pass interference challenge Added new example vignette(\"examples\") demonstrate Expected Points calculator calculate_expected_points() Fix WP 2-pt conversion negated penalty Add variables (containing team names) team standardization clean_pbp() Fix WP onside kicks","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-205","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.5","title":"nflfastR 2.0.5","text":"Fix yet another bug caused NFL providing plays order Fix bugs related penalties PATs kickoffs Fix bugs related NFL providing wrong scoring team defensive touchdowns older games involving Jaguars Fix minor issues related wrong first_down_rush return_touchdown Improved error handling fast_scraper() yet played games Improved variable documentation prepared new website Improved performance dplyr v1.0.0 Rebuilt EP WP models due bugfixes underlying data versions 2.0.3, 2.0.4 2.0.5","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-204","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.4","title":"nflfastR 2.0.4","text":"Fix another bug order plays Fix bug affecting cumulative totals WPA, air_WPA yac_WPA Fix bug affecting cumulative totals air_EPA yac_EPA","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-203","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.3","title":"nflfastR 2.0.3","text":"Fix NFL providing plays order Fix series incrementing following defensive TD","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-202","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.2","title":"nflfastR 2.0.2","text":"Fixed bug series series success calculations caused timeouts following possession change Fixed win probability PATs","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-201","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.1","title":"nflfastR 2.0.1","text":"Added minimum version requirement xgboost (>= 1.1) recent xgboost update caused breaking change leading failure adding model results data","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"models-2-0-0","dir":"Changelog","previous_headings":"","what":"Models","title":"nflfastR 2.0.0","text":"Added new models Expected Points, Win Probability Completion Probability removed nflscrapR dependency. major change stepping away well established nflscrapR models. believe good step forward. See data-raw/MODEL-README.md detailed model information. Added internal functions EPA WPA helper_add_ep_wp.R. Added new function calculate_expected_points() usable enduser.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"functions-2-0-0","dir":"Changelog","previous_headings":"","what":"Functions","title":"nflfastR 2.0.0","text":"Completely overhauled fast_scraper() make work NFL’s new server backend. option source still available deprecated since one source now. changes output well (please see ). fast_scraper() now adds game data play play data set courtesy Lee Sharpe. Game data include: away_score, home_score, location, result, total, spread_line, total_line, div_game, roof, surface, temp, wind, home_coach, away_coach, stadium, stadium_id, gameday fastcraper_schedules() now incorporates Lee Sharpe’s games.rds. functions fast_scraper_clips() fast_scraper_roster() deactivated due missing data source. might reactivated completely dropped future versions. function fix_fumbles() renamed add_qb_epa() new name much better describes function actually .","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"miscellaneous-2-0-0","dir":"Changelog","previous_headings":"","what":"Miscellaneous","title":"nflfastR 2.0.0","text":"Added progress information using progressrpackage removed furrr progress bars. clean_pbp() now adds column ìd id player column name. piece together different data cover full span years, player IDs consistent early (1999-2010) recent (2011 onward) periods. Added NEWS.md file track changes package. Fixed several bugs inhereted nflscrapR, including one EPA missing play followed two timeouts (example, two-minute warning followed timeout), another play_type incorrect plays declined penalties. Fixed bug, receiver_player_name receiver didn’t name correct players plays lateral passes.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"play-by-play-output-2-0-0","dir":"Changelog","previous_headings":"","what":"Play-by-Play Output","title":"nflfastR 2.0.0","text":"output changed little bit.","code":""},{"path":[]},{"path":[]},{"path":[]}] +[{"path":"https://www.nflfastr.com/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2020 Sebastian Carl; Ben Baldwin Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"A beginner's guide to nflfastR","text":"following guide assume R installed. also highly recommend working RStudio. need help getting installed unfamiliar RStudio laid , please see section Lee Sharpe’s guide. quick word ’re new programming: happening R. Obviously, need install R computer . Make sure save ’re script (RStudio, File –> New File –> R script) can save work run multiple lines code . run code script, highlight want, press control + enter press Run button top editor (see Lee’s guide). don’t highlight anything press control + enter, currently selected line run. go R journey, might get stuck google bunch things, ’s totally okay normal. ’s got started!","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"setup","dir":"Articles","previous_headings":"","what":"Setup","title":"A beginner's guide to nflfastR","text":"First, need install magic packages. need run step given computer. can just type RStudio console (look Console pane RStudio) directly since ’re never going .","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"install-packages","dir":"Articles","previous_headings":"Setup","what":"Install packages","title":"A beginner's guide to nflfastR","text":"","code":"install.packages(\"tidyverse\", type = \"binary\") install.packages(\"ggrepel\", type = \"binary\") install.packages(\"nflreadr\", type = \"binary\") install.packages(\"nflplotR\", type = \"binary\")"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"load-packages","dir":"Articles","previous_headings":"Setup","what":"Load packages","title":"A beginner's guide to nflfastR","text":"Okay, now ’s stuff ’re going want start putting R script. following loads tidyverse, contains lot helper functions working data ggrepel making figures, along nflreadr (allows one quickly download nflfastR data, along lot data). Finally, nflplotR makes plotting easier. one optional makes R prefer display numbers scientific notation, find annoying:","code":"library(tidyverse) library(ggrepel) library(nflreadr) library(nflplotR) options(scipen = 9999)"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"load-data","dir":"Articles","previous_headings":"Setup","what":"Load data","title":"A beginner's guide to nflfastR","text":"load full play play 2019 season (including playoffs). ’ll get get seasons later. Note downloading pre-cleaned data nflfastR data repository using load_pbp() function included nflreadr, much faster building pbp scratch.","code":"data <- load_pbp(2019)"},{"path":[]},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"dimensions","dir":"Articles","previous_headings":"Basics: how to look at your data","what":"Dimensions","title":"A beginner's guide to nflfastR","text":"moving forward, ways get sense ’s dataframe. can check dimensions data, tells us 47260 rows (.e., plays) data 372 columns (variables): str displays structure dataframe: , ’ve added [1:10], selects first 10 columns, otherwise list extremely long (remember 372 columns!). Normally, just type str(data). can similarly take glimpse data: ’m showing first 10 columns. usual command glimpse(data).","code":"dim(data) #> [1] 47260 372 str(data[1:10]) #> nflvrs_d [47,260 × 10] (S3: nflverse_data/tbl_df/tbl/data.table/data.frame) #> $ play_id : num [1:47260] 1 36 51 79 100 121 148 185 214 239 ... #> $ game_id : chr [1:47260] \"2019_01_ATL_MIN\" \"2019_01_ATL_MIN\" \"2019_01_ATL_MIN\" \"2019_01_ATL_MIN\" ... #> $ old_game_id : chr [1:47260] \"2019090804\" \"2019090804\" \"2019090804\" \"2019090804\" ... #> $ home_team : chr [1:47260] \"MIN\" \"MIN\" \"MIN\" \"MIN\" ... #> $ away_team : chr [1:47260] \"ATL\" \"ATL\" \"ATL\" \"ATL\" ... #> $ season_type : chr [1:47260] \"REG\" \"REG\" \"REG\" \"REG\" ... #> $ week : int [1:47260] 1 1 1 1 1 1 1 1 1 1 ... #> $ posteam : chr [1:47260] NA \"ATL\" \"ATL\" \"ATL\" ... #> $ posteam_type: chr [1:47260] NA \"away\" \"away\" \"away\" ... #> $ defteam : chr [1:47260] NA \"MIN\" \"MIN\" \"MIN\" ... #> - attr(*, \"nflverse_timestamp\")= POSIXct[1:1], format: \"2024-03-07 14:39:28\" #> - attr(*, \"nflverse_type\")= chr \"play by play data\" #> - attr(*, \"nflfastR_version\")=Classes 'package_version', 'numeric_version' hidden list of 1 #> ..$ : int [1:4] 4 6 1 9007 glimpse(data[1:10]) #> Rows: 47,260 #> Columns: 10 #> $ play_id 1, 36, 51, 79, 100, 121, 148, 185, 214, 239, 255, 277, 29… #> $ game_id \"2019_01_ATL_MIN\", \"2019_01_ATL_MIN\", \"2019_01_ATL_MIN\", … #> $ old_game_id \"2019090804\", \"2019090804\", \"2019090804\", \"2019090804\", \"… #> $ home_team \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"… #> $ away_team \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"… #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"… #> $ week 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, … #> $ posteam NA, \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"MIN\", \"MIN\", \"MIN… #> $ posteam_type NA, \"away\", \"away\", \"away\", \"away\", \"away\", \"home\", \"home… #> $ defteam NA, \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"ATL\", \"ATL\", \"ATL…"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"variable-names","dir":"Articles","previous_headings":"Basics: how to look at your data","what":"Variable names","title":"A beginner's guide to nflfastR","text":"Another useful command get names variables data, get entering names(data) (won’t show , , 372 columns). lot work !","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"viewer","dir":"Articles","previous_headings":"Basics: how to look at your data","what":"Viewer","title":"A beginner's guide to nflfastR","text":"One way look data View() function. ’re coming Excel background, help feel home way see ’s data. open viewer RStudio new panel. Try ! Since many columns, Viewer won’t show . pick columns view, can select : %>% thing lets pipe together bunch different commands. ’re taking data, “select”ing variables want look , Viewing. , can’t display results , try !","code":"View(data) data %>% select(home_team, away_team, posteam, desc) %>% View()"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"head-manipulation","dir":"Articles","previous_headings":"Basics: how to look at your data","what":"Head + manipulation","title":"A beginner's guide to nflfastR","text":"start, let’s just look first rows (“head”) data. couple things. “desc” important variable lists description happened play, head says show first rows (“head” data). Since already sorted game, first 6 rows week 1 game, ATL @ MIN. make code easier read, people often put part pipe new line, useful working complicated functions. run: return exact output one written multiple lines, code isn’t easy read. ’ve covered select, next important function learn filter, lets filter data want. following returns plays run plays pass plays; .e., punts, kickoffs, field goals, dead ball penalties (e.g. false starts) don’t know attempted play . Compared first time , opening line start game, kickoff, punt now gone. Note ’re checking whether variable equal something, need use double equals sign == like . ’s probably technical reason [shrug emoji]. Also, character | used “”, & “”. rush == 1 | pass == 1 means “rush pass”. Note rush, pass, name, passer, rusher, receiver columns nflfastR creations, provided make working data easier. can see , passer filled dropbacks (including sacks scrambles, also pass = 1), name equal passer pass plays rusher rush plays. Think primary player involved play. wanted view special teams plays? , can use filter: Fourth plays? Fourth plays aren’t special teams plays? far, ’ve just taking look initial dataset downloaded, none results preserved. save new dataframe just plays want, need use <- assign new dataframe. Let’s save new dataframe ’s just run plays pass plays non-missing EPA, called pbp_rp. , !.na(epa) means exclude plays missing (na) EPA. ! symbol often used computer folk negate something, .na(epa) means “EPA missing” !.na(epa) means “EPA missing”, used .","code":"data %>% select(posteam, defteam, desc, rush, pass) %>% head() #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 6 × 5 #> posteam defteam desc rush pass #> #> 1 NA NA GAME 0 0 #> 2 ATL MIN 5-D.Bailey kicks 65 yards from MIN 35 to end zone… 0 0 #> 3 ATL MIN (15:00) 2-M.Ryan sacked at ATL 17 for -8 yards (5… 0 1 #> 4 ATL MIN (14:20) 24-D.Freeman right tackle to ATL 21 for 4… 1 0 #> 5 ATL MIN (13:41) (Shotgun) 2-M.Ryan scrambles left end to … 0 1 #> 6 ATL MIN (12:59) 5-M.Bosher punt is BLOCKED by 50-E.Wilson… 0 0 data %>% select(posteam, defteam, desc, rush, pass) %>% head() data %>% filter(rush == 1 | pass == 1) %>% select(posteam, desc, rush, pass, name, passer, rusher, receiver) %>% head() #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 6 × 8 #> posteam desc rush pass name passer rusher receiver #> #> 1 ATL (15:00) 2-M.Ryan sacked at A… 0 1 M.Ry… M.Ryan NA NA #> 2 ATL (14:20) 24-D.Freeman right t… 1 0 D.Fr… NA D.Fre… NA #> 3 ATL (13:41) (Shotgun) 2-M.Ryan s… 0 1 M.Ry… M.Ryan NA NA #> 4 MIN (12:53) 33-D.Cook right end … 1 0 D.Co… NA D.Cook NA #> 5 MIN (12:32) 8-K.Cousins pass sho… 0 1 K.Co… K.Cou… NA D.Cook #> 6 MIN (11:57) 8-K.Cousins pass sho… 0 1 K.Co… K.Cou… NA A.Thiel… data %>% filter(special == 1) %>% select(down, ydstogo, desc) %>% head() #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 6 × 3 #> down ydstogo desc #> #> 1 NA 0 5-D.Bailey kicks 65 yards from MIN 35 to end zone, Touchback. #> 2 4 2 (12:59) 5-M.Bosher punt is BLOCKED by 50-E.Wilson, Center-47-J.… #> 3 NA 0 (Kick formation) 5-D.Bailey extra point is GOOD, Center-58-A.Cu… #> 4 NA 0 5-D.Bailey kicks 67 yards from MIN 35 to ATL -2. 38-K.Barner to… #> 5 NA 0 (Kick formation) 5-D.Bailey extra point is GOOD, Center-58-A.Cu… #> 6 NA 0 5-D.Bailey kicks 65 yards from MIN 35 to end zone, Touchback. data %>% filter(down == 4) %>% select(down, ydstogo, desc) %>% head() #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 6 × 3 #> down ydstogo desc #> #> 1 4 2 (12:59) 5-M.Bosher punt is BLOCKED by 50-E.Wilson, Center-47-J.… #> 2 4 19 (2:38) 5-M.Bosher punts 33 yards to MIN 8, Center-47-J.Harris, … #> 3 4 20 (12:33) 2-B.Colquitt punts 51 yards to ATL 17, Center-58-A.Cutt… #> 4 4 27 (1:49) 5-M.Bosher punts 45 yards to MIN 10, Center-47-J.Harris,… #> 5 4 10 (:49) 2-B.Colquitt punts 57 yards to ATL 33, Center-58-A.Cuttin… #> 6 4 1 (10:56) 2-B.Colquitt punts 42 yards to ATL 10, Center-58-A.Cutt… data %>% filter(down == 4 & special == 0) %>% select(down, ydstogo, desc) %>% head() #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 6 × 3 #> down ydstogo desc #> #> 1 4 5 (9:25) (Shotgun) 2-M.Ryan pass deep left to 18-C.Ridley for 20 … #> 2 4 2 (4:39) (Punt formation) PENALTY on MIN, Delay of Game, 5 yards,… #> 3 4 2 (1:27) (No Huddle, Shotgun) 2-M.Ryan pass short left to 11-J.Jo… #> 4 4 1 (2:59) (Punt formation) Direct snap to 41-A.Levine. 41-A.Levin… #> 5 4 3 (9:30) (Shotgun) 3-R.Griffin pass short left to 89-M.Andrews fo… #> 6 4 1 (3:55) 17-J.Allen FUMBLES (Aborted) at NYJ 37, RECOVERED by NYJ… pbp_rp <- data %>% filter(rush == 1 | pass == 1, !is.na(epa))"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"some-basic-stuff-part-1","dir":"Articles","previous_headings":"","what":"Some basic stuff: Part 1","title":"A beginner's guide to nflfastR","text":"Okay, big dataset call dropbacks pass plays non-dropbacks rush plays. Now actually want , like, stuff.","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"group-by-and-summarize","dir":"Articles","previous_headings":"Some basic stuff: Part 1","what":"Group by and Summarize","title":"A beginner's guide to nflfastR","text":"Let’s take look various Cowboys’ running backs fared run plays 2019: ’s lot going . ’ve covered filter already. group_by function extremely useful function , well, groups tell – case rusher. Summarize useful collapsing data summary ’re looking , , grouping player, ’re summarizing mean EPA, success, yardage (bad rushing stat, since ’re ), getting number plays using n(), returns number group. Unsurprisingly, Prescott much effective rusher 2019 running backs, meaningful difference Pollard Elliott efficiency. check PFR team stats page, ’ll notice doesn’t match official stats. nflfastR computes EPA provides player names plays penalties two-point conversions. wanting match official stats, need restrict <= 4 (excluded two-point conversions, listed NA) play_type = run (exclude penalties, play_type = no_play): Now exactly match PFR: Zeke 301 carries 4.5 yards/carry, Pollard 86 carries 5.3 yards/carry. Note still aren’t matching Dak’s stats PFR NFL classifies scrambles rush attempts nflfastR .","code":"pbp_rp %>% filter(posteam == \"DAL\", rush == 1) %>% group_by(rusher) %>% summarize( mean_epa = mean(epa), success_rate = mean(success), ypc = mean(yards_gained), plays = n() ) %>% arrange(-mean_epa) %>% filter(plays > 20) #> # A tibble: 3 × 5 #> rusher mean_epa success_rate ypc plays #> #> 1 D.Prescott 0.288 0.591 6.41 22 #> 2 T.Pollard -0.0265 0.456 5.08 90 #> 3 E.Elliott -0.0412 0.411 4.39 309 pbp_rp %>% filter(posteam == \"DAL\", down <= 4, play_type == 'run') %>% group_by(rusher) %>% summarize( mean_epa = mean(epa), success_rate = mean(success), ypc=mean(yards_gained), plays=n() ) %>% filter(plays > 20) #> # A tibble: 3 × 5 #> rusher mean_epa success_rate ypc plays #> #> 1 D.Prescott 0.288 0.591 6.41 22 #> 2 E.Elliott -0.0185 0.422 4.51 301 #> 3 T.Pollard -0.0210 0.453 5.29 86"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"manipulating-columns-mutate-if_else-and-case_when","dir":"Articles","previous_headings":"Some basic stuff: Part 1","what":"Manipulating columns: mutate, if_else, and case_when","title":"A beginner's guide to nflfastR","text":"Let’s say want make new column, named home, equal 1 team ball home team. Let’s introduce another extremely useful function, if_else: mutate R’s word creating new column (overwriting existing one); case, ’ve created new column called home. uses if_else, uses following pattern: condition (case, posteam == home_team), value condition true (case, posteam == home_team, 1), value condition false (0). use , example, look average EPA/play home road teams: Note EPA/play similar home teams away teams home already built nflfastR EPA model, result expected. Actually, away EPA/play actually somewhat higher, presumably away teams -performed usual 2019 homefield advantage continues decline generally. if_else nice ’re creating new column based simple condition. need something complicated? case_when good option. ’s works: Note new syntax case_when: condition (first one, air yards less 0), followed ~, followed assignment (first one, “Negative”). , created 4 bins based air yards got average completion probability (cp) based nflfastR model. Unsurprisingly, cp lower longer downfield throw goes.","code":"pbp_rp %>% mutate( home = if_else(posteam == home_team, 1, 0) ) %>% select(posteam, home_team, home) %>% head(10) #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 10 × 3 #> posteam home_team home #> #> 1 ATL MIN 0 #> 2 ATL MIN 0 #> 3 ATL MIN 0 #> 4 MIN MIN 1 #> 5 MIN MIN 1 #> 6 MIN MIN 1 #> 7 ATL MIN 0 #> 8 ATL MIN 0 #> 9 ATL MIN 0 #> 10 MIN MIN 1 pbp_rp %>% mutate( home = if_else(posteam == home_team, 1, 0) ) %>% group_by(home) %>% summarize(epa = mean(epa)) #> # A tibble: 2 × 2 #> home epa #> #> 1 0 0.0215 #> 2 1 -0.0158 pbp_rp %>% filter(!is.na(cp)) %>% mutate( depth = case_when( air_yards < 0 ~ \"Negative\", air_yards >= 0 & air_yards < 10 ~ \"Short\", air_yards >= 10 & air_yards < 20 ~ \"Medium\", air_yards >= 20 ~ \"Deep\" ) ) %>% group_by(depth) %>% summarize(cp = mean(cp)) #> # A tibble: 4 × 2 #> depth cp #> #> 1 Deep 0.367 #> 2 Medium 0.573 #> 3 Negative 0.847 #> 4 Short 0.718"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"a-basic-figure","dir":"Articles","previous_headings":"Some basic stuff: Part 1","what":"A basic figure","title":"A beginner's guide to nflfastR","text":"Now ’ve gained skills manipulating data, let’s put use making things. teams pass-heavy first half early downs win probability 20 80, excluding final 2 minutes half everyone pass-happy? , ’ve already used filter, group_by, summarize. new function using arrange, sorts data variable(s) given. minus sign front mean_pass means sort descending order. Let’s make first figure: image kind mess – still need title, axis labels, etc – gets point across. ’ll get stuff later. importantly, made something interesting using nflfastR data! “reorder” sorts teams according pass rate, “-” saying descending order. “aes” short “aesthetic”, R’s weird way asking variables go x y axes. Looking figure, Chiefs never playoff success establish run.","code":"schotty <- pbp_rp %>% filter(wp > .20 & wp < .80 & down <= 2 & qtr <= 2 & half_seconds_remaining > 120) %>% group_by(posteam) %>% summarize(mean_pass = mean(pass), plays = n()) %>% arrange(-mean_pass) schotty #> # A tibble: 32 × 3 #> posteam mean_pass plays #> #> 1 KC 0.691 388 #> 2 MIA 0.594 288 #> 3 NO 0.585 325 #> 4 LA 0.584 329 #> 5 CHI 0.561 310 #> 6 CLE 0.555 272 #> 7 CAR 0.554 271 #> 8 TB 0.551 321 #> 9 GB 0.550 291 #> 10 ARI 0.548 325 #> # ℹ 22 more rows ggplot(schotty, aes(x=reorder(posteam,-mean_pass), y=mean_pass)) + geom_text(aes(label=posteam))"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"loading-multiple-seasons","dir":"Articles","previous_headings":"","what":"Loading multiple seasons","title":"A beginner's guide to nflfastR","text":"data stored data repository, fast load data multiple seasons. loads play--play data 2015 2019 seasons. Let’s make sure got . now, understand : season 48,000 plays. Just fun, let’s look various play types:","code":"pbp <- load_pbp(2015:2019) pbp %>% group_by(season) %>% summarize(n = n()) #> # A tibble: 5 × 2 #> season n #> #> 1 2015 48122 #> 2 2016 47651 #> 3 2017 47242 #> 4 2018 47109 #> 5 2019 47260 pbp %>% group_by(play_type) %>% summarize(n = n()) #> # A tibble: 10 × 2 #> play_type n #> #> 1 extra_point 6240 #> 2 field_goal 5155 #> 3 kickoff 13614 #> 4 no_play 22745 #> 5 pass 99984 #> 6 punt 12083 #> 7 qb_kneel 2090 #> 8 qb_spike 340 #> 9 run 68128 #> 10 NA 7005"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"figures-with-qb-stats","dir":"Articles","previous_headings":"","what":"Figures with QB stats","title":"A beginner's guide to nflfastR","text":"Let’s stuff quarterbacks: Lots new stuff . First, ’re grouping id name make sure ’re getting unique players; .e., two players name (like Javorius Allen Josh Allen J.Allen), also using id differentiate . qb_epa nflfastR creation equal EPA instances except pass completed fumble lost, case QB gets “credit” play spot fumble lost (making EPA function like passing yards). last part summarize comment gets last team player observed playing . way getting dataset quarterbacks without joining external roster data make sure hit number dropbacks. case, filtering n_dropbacks > 100 makes sure ’re including quarterbacks. ungroup() near end good practice grouping make sure don’t get weird behavior data created line. Let’s make figures. load_teams() function provided nflreadr package, since already loaded package, ’s ready use. Let’s join qbs dataframe created: left_join means keep rows left dataframe (first one provided, qbs), join rows available rows dataframe. also need provide joining variables, team qbs team_abbr load_teams(). type = c('team' = 'team_abbr')? knows, ’s left_join requires instructions match.","code":"qbs <- pbp %>% filter(season_type == \"REG\", !is.na(epa)) %>% group_by(id, name) %>% summarize( epa = mean(qb_epa), cpoe = mean(cpoe, na.rm = T), n_dropbacks = sum(pass), n_plays = n(), team = last(posteam) ) %>% ungroup() %>% filter(n_dropbacks > 100 & n_plays > 1000) #> `summarise()` has grouped output by 'id'. You can override using the `.groups` #> argument. load_teams() #> ── nflverse team graphics ────────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 11:08:30 UTC #> # A tibble: 32 × 16 #> team_abbr team_name team_id team_nick team_conf team_division team_color #> #> 1 ARI Arizona Cardi… 3800 Cardinals NFC NFC West #97233F #> 2 ATL Atlanta Falco… 0200 Falcons NFC NFC South #A71930 #> 3 BAL Baltimore Rav… 0325 Ravens AFC AFC North #241773 #> 4 BUF Buffalo Bills 0610 Bills AFC AFC East #00338D #> 5 CAR Carolina Pant… 0750 Panthers NFC NFC South #0085CA #> 6 CHI Chicago Bears 0810 Bears NFC NFC North #0B162A #> 7 CIN Cincinnati Be… 0920 Bengals AFC AFC North #FB4F14 #> 8 CLE Cleveland Bro… 1050 Browns AFC AFC North #FF3C00 #> 9 DAL Dallas Cowboys 1200 Cowboys NFC NFC East #002244 #> 10 DEN Denver Broncos 1400 Broncos AFC AFC West #002244 #> # ℹ 22 more rows #> # ℹ 9 more variables: team_color2 , team_color3 , team_color4 , #> # team_logo_wikipedia , team_logo_espn , team_wordmark , #> # team_conference_logo , team_league_logo , team_logo_squared qbs <- qbs %>% left_join(load_teams(), by = c('team' = 'team_abbr'))"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"with-team-color-dots","dir":"Articles","previous_headings":"Figures with QB stats","what":"With team color dots","title":"A beginner's guide to nflfastR","text":"Now can make figure! looks complicated, just way getting bunch different stuff plot: lines averages, dots, names, etc. added comments explain going , practice making figures usually just copy paste stuff /google need.","code":"qbs %>% ggplot(aes(x = cpoe, y = epa)) + #horizontal line with mean EPA geom_hline(yintercept = mean(qbs$epa), color = \"red\", linetype = \"dashed\", alpha=0.5) + #vertical line with mean CPOE geom_vline(xintercept = mean(qbs$cpoe), color = \"red\", linetype = \"dashed\", alpha=0.5) + #add points for the QBs with the right colors #cex controls point size and alpha the transparency (alpha = 1 is normal) geom_point(color = qbs$team_color, cex=qbs$n_plays / 350, alpha = .6) + #add names using ggrepel, which tries to make them not overlap geom_text_repel(aes(label=name)) + #add a smooth line fitting cpoe + epa stat_smooth(geom='line', alpha=0.5, se=FALSE, method='lm')+ #titles and caption labs(x = \"Completion % above expected (CPOE)\", y = \"EPA per play (passes, rushes, and penalties)\", title = \"Quarterback Efficiency, 2015 - 2019\", caption = \"Data: @nflfastR\") + #uses the black and white ggplot theme theme_bw() + #center title with hjust = 0.5 theme( plot.title = element_text(size = 14, hjust = 0.5, face = \"bold\") ) + #make ticks look nice #if this doesn't work, `install.packages('scales')` scale_y_continuous(breaks = scales::pretty_breaks(n = 10)) + scale_x_continuous(breaks = scales::pretty_breaks(n = 10))"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"with-team-logos","dir":"Articles","previous_headings":"Figures with QB stats","what":"With team logos","title":"A beginner's guide to nflfastR","text":"also make plot team logos: changes ’ve made use geom_nfl_logos instead geom_point (figure right size images width part? Trial error). figure look better fewer players shown, point explaining stuff, let’s call good enough.","code":"qbs %>% ggplot(aes(x = cpoe, y = epa)) + #horizontal line with mean EPA geom_hline(yintercept = mean(qbs$epa), color = \"red\", linetype = \"dashed\", alpha=0.5) + #vertical line with mean CPOE geom_vline(xintercept = mean(qbs$cpoe), color = \"red\", linetype = \"dashed\", alpha=0.5) + #add points for the QBs with the logos (this uses nflplotR package) geom_nfl_logos(aes(team_abbr = team), width = qbs$n_plays / 45000, alpha = 0.75) + #add names using ggrepel, which tries to make them not overlap geom_text_repel(aes(label=name)) + #add a smooth line fitting cpoe + epa stat_smooth(geom='line', alpha=0.5, se=FALSE, method='lm')+ #titles and caption labs(x = \"Completion % above expected (CPOE)\", y = \"EPA per play (passes, rushes, and penalties)\", title = \"Quarterback Efficiency, 2015 - 2019\", caption = \"Data: @nflfastR\") + theme_bw() + #center title theme( plot.title = element_text(size = 14, hjust = 0.5, face = \"bold\") ) + #make ticks look nice scale_y_continuous(breaks = scales::pretty_breaks(n = 10)) + scale_x_continuous(breaks = scales::pretty_breaks(n = 10))"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"team-tiers-plot","dir":"Articles","previous_headings":"Figures with QB stats","what":"Team tiers plot","title":"A beginner's guide to nflfastR","text":"’s helpful, notes chart originally shown , like uses nflplotR team logos. geom_mean_lines() function adds mean lines offensive defensive EPA per play slope lines created using geom_abline() scale_y_reverse() reverses vertical axis = better defense Everything else comprehensible now!","code":"library(nflplotR) # get pbp and filter to regular season rush and pass plays pbp <- nflreadr::load_pbp(2005) %>% dplyr::filter(season_type == \"REG\") %>% dplyr::filter(!is.na(posteam) & (rush == 1 | pass == 1)) # offense epa offense <- pbp %>% dplyr::group_by(team = posteam) %>% dplyr::summarise(off_epa = mean(epa, na.rm = TRUE)) # defense epa defense <- pbp %>% dplyr::group_by(team = defteam) %>% dplyr::summarise(def_epa = mean(epa, na.rm = TRUE)) # make figure offense %>% dplyr::inner_join(defense, by = \"team\") %>% ggplot2::ggplot(aes(x = off_epa, y = def_epa)) + # tier lines ggplot2::geom_abline(slope = -1.5, intercept = (4:-3)/10, alpha = .2) + # nflplotR magic nflplotR::geom_mean_lines(aes(y0 = off_epa, x0 = def_epa)) + nflplotR::geom_nfl_logos(aes(team_abbr = team), width = 0.07, alpha = 0.7) + ggplot2::labs( x = \"Offense EPA/play\", y = \"Defense EPA/play\", caption = \"Data: @nflfastR\", title = \"2005 NFL Offensive and Defensive EPA per Play\" ) + ggplot2::theme_bw() + ggplot2::theme( plot.title = ggplot2::element_text(size = 12, hjust = 0.5, face = \"bold\") ) + ggplot2::scale_y_reverse()"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"a-few-more-things-on-plotting","dir":"Articles","previous_headings":"Figures with QB stats","what":"A few more things on plotting","title":"A beginner's guide to nflfastR","text":"two ways view plots. One RStudio Viewer, shows RStudio plot something. plots RStudio viewer look ugly pixelated, probably need install Cairo package set default viewer Tools –> Global Options –> General –> Graphics –> Backend: Set Cairo. save .png preferred dimensions resolution. example, ggsave(\"test.png\", width = 16, height = 9, units = \"cm\") save current plot “test.png” units specified (can view ggsave options ). One note: RStudio Viewer can take long time preview ggplots, especially ’re things like adding images. ’re getting frustrated plot taking long time display, can take advantage ggpreview nflplotR. , first save plot object run ggpreview (doesn’t make sense, see examples ).","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"real-life-example-lets-make-a-win-total-model","dir":"Articles","previous_headings":"","what":"Real life example: let’s make a win total model","title":"A beginner's guide to nflfastR","text":"’m going try go process cleaning joining multiple data sets try get sense approach something like , step--step.","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"get-team-wins-each-season","dir":"Articles","previous_headings":"Real life example: let’s make a win total model","what":"Get team wins each season","title":"A beginner's guide to nflfastR","text":"’re going cheat little take advantage Lee Sharpe’s famous games file. stuff added nflfastR, ’s easier working file game one row. ’re curious, triple colon way access referred non-exported functions package. Think like secret menu (secret? Sometimes package developers want limit number exported functions overwhelming). start, want create dataframe row team-season observation, listing many games won. multiple ways , ’m going just take home away results bind together. example, ’s home results look like: Note used rename change home_team team. away teams, need flip result since result given perspective home team. Now let’s make columns called win based result. results %>% filter(season == 2019 & team == 'SEA') part end isn’t actually saving data new form, just making sure previous step wanted. good habit get : frequently inspect data make sure looks like think . Now dataframe wanted, can get team wins season easily: , ’re making sure data looks like “” checking 5 seasons wins, making sure looks right. Now team-season win point differential data ready, need go back nflfastR data get EPA/play.","code":"games <- nflreadr::load_schedules() str(games) #> nflvrs_d [6,706 × 46] (S3: nflverse_data/tbl_df/tbl/data.table/data.frame) #> $ game_id : chr [1:6706] \"1999_01_MIN_ATL\" \"1999_01_KC_CHI\" \"1999_01_PIT_CLE\" \"1999_01_OAK_GB\" ... #> $ season : int [1:6706] 1999 1999 1999 1999 1999 1999 1999 1999 1999 1999 ... #> $ game_type : chr [1:6706] \"REG\" \"REG\" \"REG\" \"REG\" ... #> $ week : int [1:6706] 1 1 1 1 1 1 1 1 1 1 ... #> $ gameday : chr [1:6706] \"1999-09-12\" \"1999-09-12\" \"1999-09-12\" \"1999-09-12\" ... #> $ weekday : chr [1:6706] \"Sunday\" \"Sunday\" \"Sunday\" \"Sunday\" ... #> $ gametime : chr [1:6706] NA NA NA NA ... #> $ away_team : chr [1:6706] \"MIN\" \"KC\" \"PIT\" \"OAK\" ... #> $ away_score : int [1:6706] 17 17 43 24 14 3 10 30 25 28 ... #> $ home_team : chr [1:6706] \"ATL\" \"CHI\" \"CLE\" \"GB\" ... #> $ home_score : int [1:6706] 14 20 0 28 31 41 19 28 24 20 ... #> $ location : chr [1:6706] \"Home\" \"Home\" \"Home\" \"Home\" ... #> $ result : int [1:6706] -3 3 -43 4 17 38 9 -2 -1 -8 ... #> $ total : int [1:6706] 31 37 43 52 45 44 29 58 49 48 ... #> $ overtime : int [1:6706] 0 0 0 0 0 0 0 0 0 0 ... #> $ old_game_id : chr [1:6706] \"1999091210\" \"1999091206\" \"1999091213\" \"1999091208\" ... #> $ gsis : int [1:6706] 598 597 604 602 591 603 592 600 588 596 ... #> $ nfl_detail_id : chr [1:6706] NA NA NA NA ... #> $ pfr : chr [1:6706] \"199909120atl\" \"199909120chi\" \"199909120cle\" \"199909120gnb\" ... #> $ pff : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ espn : chr [1:6706] \"190912001\" \"190912003\" \"190912005\" \"190912009\" ... #> $ ftn : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ away_rest : int [1:6706] 7 7 7 7 7 7 7 7 7 7 ... #> $ home_rest : int [1:6706] 7 7 7 7 7 7 7 7 7 7 ... #> $ away_moneyline : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ home_moneyline : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ spread_line : num [1:6706] -4 -3 -6 9 -3 5.5 3.5 7 -3 9.5 ... #> $ away_spread_odds: int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ home_spread_odds: int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ total_line : num [1:6706] 49 38 37 43 45.5 49 38 44.5 37 42 ... #> $ under_odds : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ over_odds : int [1:6706] NA NA NA NA NA NA NA NA NA NA ... #> $ div_game : int [1:6706] 0 0 1 0 1 0 1 1 1 0 ... #> $ roof : chr [1:6706] \"dome\" \"outdoors\" \"outdoors\" \"outdoors\" ... #> $ surface : chr [1:6706] \"astroturf\" \"grass\" \"grass\" \"grass\" ... #> $ temp : int [1:6706] NA 80 78 67 NA 76 NA 73 75 NA ... #> $ wind : int [1:6706] NA 12 12 10 NA 8 NA 5 3 NA ... #> $ away_qb_id : chr [1:6706] \"00-0003761\" \"00-0006300\" \"00-0015700\" \"00-0005741\" ... #> $ home_qb_id : chr [1:6706] \"00-0002876\" \"00-0010560\" \"00-0004230\" \"00-0005106\" ... #> $ away_qb_name : chr [1:6706] \"Randall Cunningham\" \"Elvis Grbac\" \"Kordell Stewart\" \"Rich Gannon\" ... #> $ home_qb_name : chr [1:6706] \"Chris Chandler\" \"Shane Matthews\" \"Ty Detmer\" \"Brett Favre\" ... #> $ away_coach : chr [1:6706] \"Dennis Green\" \"Gunther Cunningham\" \"Bill Cowher\" \"Jon Gruden\" ... #> $ home_coach : chr [1:6706] \"Dan Reeves\" \"Dick Jauron\" \"Chris Palmer\" \"Ray Rhodes\" ... #> $ referee : chr [1:6706] \"Gerry Austin\" \"Phil Luckett\" \"Bob McElwee\" \"Tony Corrente\" ... #> $ stadium_id : chr [1:6706] \"ATL00\" \"CHI98\" \"CLE00\" \"GNB00\" ... #> $ stadium : chr [1:6706] \"Georgia Dome\" \"Soldier Field\" \"Cleveland Browns Stadium\" \"Lambeau Field\" ... #> - attr(*, \"nflverse_type\")= chr \"games and schedules\" #> - attr(*, \"nflverse_timestamp\")= POSIXct[1:1], format: \"2024-03-11 11:08:58\" home <- games %>% filter(game_type == 'REG') %>% select(season, week, home_team, result) %>% rename(team = home_team) home %>% head(5) #> ── nflverse games and schedules ──────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 11:08:58 UTC #> # A tibble: 5 × 4 #> season week team result #> #> 1 1999 1 ATL -3 #> 2 1999 1 CHI 3 #> 3 1999 1 CLE -43 #> 4 1999 1 GB 4 #> 5 1999 1 IND 17 away <- games %>% filter(game_type == 'REG') %>% select(season, week, away_team, result) %>% rename(team = away_team) %>% mutate(result = -result) away %>% head(5) #> ── nflverse games and schedules ──────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 11:08:58 UTC #> # A tibble: 5 × 4 #> season week team result #> #> 1 1999 1 MIN 3 #> 2 1999 1 KC -3 #> 3 1999 1 PIT 43 #> 4 1999 1 OAK -4 #> 5 1999 1 BUF -17 results <- bind_rows(home, away) %>% arrange(week) %>% mutate( win = case_when( result > 0 ~ 1, result < 0 ~ 0, result == 0 ~ 0.5 ) ) results %>% filter(season == 2019 & team == 'SEA') #> ── nflverse games and schedules ──────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 11:08:58 UTC #> # A tibble: 16 × 5 #> season week team result win #> #> 1 2019 1 SEA 1 1 #> 2 2019 2 SEA 2 1 #> 3 2019 3 SEA -6 0 #> 4 2019 4 SEA 17 1 #> 5 2019 5 SEA 1 1 #> 6 2019 6 SEA 4 1 #> 7 2019 7 SEA -14 0 #> 8 2019 8 SEA 7 1 #> 9 2019 9 SEA 6 1 #> 10 2019 10 SEA 3 1 #> 11 2019 12 SEA 8 1 #> 12 2019 13 SEA 7 1 #> 13 2019 14 SEA -16 0 #> 14 2019 15 SEA 6 1 #> 15 2019 16 SEA -14 0 #> 16 2019 17 SEA -5 0 team_wins <- results %>% group_by(team, season) %>% summarize( wins = sum(win), point_diff = sum(result)) %>% ungroup() #> `summarise()` has grouped output by 'team'. You can override using the #> `.groups` argument. team_wins %>% arrange(-wins) %>% head(5) #> # A tibble: 5 × 4 #> team season wins point_diff #> #> 1 NE 2007 16 315 #> 2 CAR 2015 15 192 #> 3 GB 2011 15 201 #> 4 PIT 2004 15 121 #> 5 BAL 2019 14 249"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"get-team-epa-by-season","dir":"Articles","previous_headings":"Real life example: let’s make a win total model","what":"Get team EPA by season","title":"A beginner's guide to nflfastR","text":"Let’s start getting data every season nflfastR data repository: ’m pretty aggressive dropping rows columns (filter select) otherwise loading memory can painful computer. need ’re . Note ’m keeping regular season games (season_type == \"REG\") since analysis usually done. Now can get EPA/play offense defense. Let’s break pass rush . don’t remember let’s steps. know need group team, season, pass, ’s beginning: makes two rows per team-season. get team-season row? pivot_wider need: one hard wrap head around usually open reference page, read example, pray try works. case . Hooray! turned two-lines-per-team dataframe one, 0 column pass == 0 (run plays) 1 column pass == 1. Now let’s rename something sensible save: Note variable names numbers need surrounded tick marks work. Now can repeat process defense: Let’s another sanity check looking top 5 pass offenses defenses: top pass defenses (2002 TB, 2017 JAX, 2019 NE) offenses (2007 Pats, 2004 Colts, 2011 Packers) definitely check !","code":"pbp <- load_pbp(1999:2019) %>% filter(rush == 1 | pass == 1, season_type == \"REG\", !is.na(epa), !is.na(posteam), posteam != \"\") %>% select(season, posteam, pass, defteam, epa) pbp %>% group_by(posteam, season, pass) %>% summarize(epa = mean(epa)) %>% head(4) #> `summarise()` has grouped output by 'posteam', 'season'. You can override using #> the `.groups` argument. #> # A tibble: 4 × 4 #> # Groups: posteam, season [2] #> posteam season pass epa #> #> 1 ARI 1999 0 -0.201 #> 2 ARI 1999 1 -0.162 #> 3 ARI 2000 0 -0.240 #> 4 ARI 2000 1 -0.0718 pbp %>% group_by(posteam, season, pass) %>% summarize(epa = mean(epa)) %>% pivot_wider(names_from = pass, values_from = epa) %>% head(4) #> `summarise()` has grouped output by 'posteam', 'season'. You can override using #> the `.groups` argument. #> # A tibble: 4 × 4 #> # Groups: posteam, season [4] #> posteam season `0` `1` #> #> 1 ARI 1999 -0.201 -0.162 #> 2 ARI 2000 -0.240 -0.0718 #> 3 ARI 2001 -0.177 0.0740 #> 4 ARI 2002 -0.134 -0.0661 offense <- pbp %>% group_by(posteam, season, pass) %>% summarize(epa = mean(epa)) %>% pivot_wider(names_from = pass, values_from = epa) %>% rename(off_pass_epa = `1`, off_rush_epa = `0`) #> `summarise()` has grouped output by 'posteam', 'season'. You can override using #> the `.groups` argument. defense <- pbp %>% group_by(defteam, season, pass) %>% summarize(epa = mean(epa)) %>% pivot_wider(names_from = pass, values_from = epa) %>% rename(def_pass_epa = `1`, def_rush_epa = `0`) #> `summarise()` has grouped output by 'defteam', 'season'. You can override using #> the `.groups` argument. #top 5 offenses offense %>% arrange(-off_pass_epa) %>% head(5) #> # A tibble: 5 × 4 #> # Groups: posteam, season [5] #> posteam season off_rush_epa off_pass_epa #> #> 1 NE 2007 0.00380 0.422 #> 2 IND 2004 -0.00125 0.413 #> 3 GB 2011 -0.114 0.412 #> 4 KC 2018 0.0209 0.348 #> 5 DEN 2013 -0.0296 0.343 #top 5 defenses defense %>% arrange(def_pass_epa) %>% head(5) #> # A tibble: 5 × 4 #> # Groups: defteam, season [5] #> defteam season def_rush_epa def_pass_epa #> #> 1 TB 2002 -0.0756 -0.292 #> 2 NE 2019 -0.168 -0.241 #> 3 JAX 2017 -0.141 -0.223 #> 4 NYJ 2009 -0.104 -0.220 #> 5 LA 2003 -0.0548 -0.214"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"fix-team-names-and-join","dir":"Articles","previous_headings":"Real life example: let’s make a win total model","what":"Fix team names and join","title":"A beginner's guide to nflfastR","text":"Now ’re ready bind together. Actually, let’s make sure team names ready . Nope, yet, need fix Raiders, Rams, Chargers, LV, LA, LAC nflfastR. TRUE statement bottom says none cases found, keep team . Let’s make sure worked: HOU 3 fewer seasons didn’t exist 1999 2001, fine, team names number seasons . Okay NOW can join: Now ’re getting really close want! Next need create new columns prior year EPA, let’s point differential . Finally! Now data place can start things .","code":"team_wins %>% group_by(team) %>% summarize(n=n()) %>% arrange(n) #> # A tibble: 35 × 2 #> team n #> #> 1 LV 4 #> 2 LAC 7 #> 3 LA 8 #> 4 STL 17 #> 5 SD 18 #> 6 OAK 21 #> 7 HOU 22 #> 8 ARI 25 #> 9 ATL 25 #> 10 BAL 25 #> # ℹ 25 more rows team_wins <- team_wins %>% mutate( team = case_when( team == 'OAK' ~ 'LV', team == 'SD' ~ 'LAC', team == 'STL' ~ 'LA', TRUE ~ team ) ) team_wins %>% group_by(team) %>% summarize(n=n()) %>% arrange(n) #> # A tibble: 32 × 2 #> team n #> #> 1 HOU 22 #> 2 ARI 25 #> 3 ATL 25 #> 4 BAL 25 #> 5 BUF 25 #> 6 CAR 25 #> 7 CHI 25 #> 8 CIN 25 #> 9 CLE 25 #> 10 DAL 25 #> # ℹ 22 more rows data <- team_wins %>% left_join(offense, by = c('team' = 'posteam', 'season')) %>% left_join(defense, by = c('team' = 'defteam', 'season')) data %>% filter(team == 'SEA' & season >= 2012) #> # A tibble: 12 × 8 #> team season wins point_diff off_rush_epa off_pass_epa def_rush_epa #> #> 1 SEA 2012 11 167 -0.00476 0.213 -0.0738 #> 2 SEA 2013 13 186 -0.101 0.188 -0.128 #> 3 SEA 2014 12 140 0.0295 0.139 -0.231 #> 4 SEA 2015 10 146 -0.104 0.249 -0.148 #> 5 SEA 2016 10.5 62 -0.126 0.102 -0.207 #> 6 SEA 2017 9 34 -0.192 0.0584 -0.122 #> 7 SEA 2018 10 81 -0.0273 0.210 -0.130 #> 8 SEA 2019 11 7 -0.136 0.119 -0.0930 #> 9 SEA 2020 12 88 NA NA NA #> 10 SEA 2021 7 29 NA NA NA #> 11 SEA 2022 9 6 NA NA NA #> 12 SEA 2023 9 -38 NA NA NA #> # ℹ 1 more variable: def_pass_epa data <- data %>% arrange(team, season) %>% group_by(team) %>% mutate( prior_off_rush_epa = lag(off_rush_epa), prior_off_pass_epa = lag(off_pass_epa), prior_def_rush_epa = lag(def_rush_epa), prior_def_pass_epa = lag(def_pass_epa), prior_point_diff = lag(point_diff) ) %>% ungroup() data %>% head(5) #> # A tibble: 5 × 13 #> team season wins point_diff off_rush_epa off_pass_epa def_rush_epa #> #> 1 ARI 1999 6 -137 -0.201 -0.162 -0.0105 #> 2 ARI 2000 3 -233 -0.240 -0.0718 0.0333 #> 3 ARI 2001 7 -48 -0.177 0.0740 -0.0689 #> 4 ARI 2002 5 -155 -0.134 -0.0661 -0.0192 #> 5 ARI 2003 4 -227 -0.219 -0.120 -0.0627 #> # ℹ 6 more variables: def_pass_epa , prior_off_rush_epa , #> # prior_off_pass_epa , prior_def_rush_epa , #> # prior_def_pass_epa , prior_point_diff "},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"correlations-and-regressions","dir":"Articles","previous_headings":"Real life example: let’s make a win total model","what":"Correlations and regressions","title":"A beginner's guide to nflfastR","text":"’ve covered select, see new use minus sign de-selects variables (need de-select team name correlation work doesn’t work character strings, correlation season number meaningless). ’ve run correlation dataframe, removing missing values, rounding 2 digits. surprisingly, see wins current season strongly related passing offense EPA rushing EPA defense EPA, prior offense carries predictive power prior defense. Pass offense stable year year (0.46) rush offense (0.32), pass defense (0.28), rush defense (0.27). ’m actually surprised values passing offense aren’t higher relative others. Maybe prior results come nflscrapR era (2009 - 2019)? Let’s check looks like since 2009 relative earlier seasons: Yep, seems case. recent period, passing offense become slightly stable predictive following-year success, time rushing offense become substantially less stable less predictive future team success. Now let’s basic regression wins prior offense defense EPA/play. Maybe look recent period fit model since ’s relevant 2020. real world, rigorous making decisions like , let’s proceed anyway. ’m actually pretty surprised passing offense isn’t higher . compare simply using point differential? R2 somewhat higher just point differential. isn’t surprising ’ve thrown away special teams plays haven’t attempted make adjustments things like fumble luck know can improve EPA’s predictive power.","code":"data %>% select(-team, -season) %>% cor(use=\"complete.obs\") %>% round(2) #> wins point_diff off_rush_epa off_pass_epa def_rush_epa #> wins 1.00 0.92 0.43 0.70 -0.29 #> point_diff 0.92 1.00 0.48 0.76 -0.33 #> off_rush_epa 0.43 0.48 1.00 0.40 0.06 #> off_pass_epa 0.70 0.76 0.40 1.00 -0.01 #> def_rush_epa -0.29 -0.33 0.06 -0.01 1.00 #> def_pass_epa -0.57 -0.62 -0.04 -0.10 0.31 #> prior_off_rush_epa 0.23 0.26 0.32 0.23 0.02 #> prior_off_pass_epa 0.29 0.32 0.18 0.46 -0.01 #> prior_def_rush_epa -0.12 -0.15 0.03 -0.04 0.27 #> prior_def_pass_epa -0.18 -0.20 -0.07 -0.05 0.05 #> prior_point_diff 0.36 0.41 0.22 0.36 -0.09 #> def_pass_epa prior_off_rush_epa prior_off_pass_epa #> wins -0.57 0.23 0.29 #> point_diff -0.62 0.26 0.32 #> off_rush_epa -0.04 0.32 0.18 #> off_pass_epa -0.10 0.23 0.46 #> def_rush_epa 0.31 0.02 -0.01 #> def_pass_epa 1.00 -0.09 0.00 #> prior_off_rush_epa -0.09 1.00 0.41 #> prior_off_pass_epa 0.00 0.41 1.00 #> prior_def_rush_epa 0.16 0.05 -0.01 #> prior_def_pass_epa 0.28 0.00 -0.09 #> prior_point_diff -0.19 0.47 0.76 #> prior_def_rush_epa prior_def_pass_epa prior_point_diff #> wins -0.12 -0.18 0.36 #> point_diff -0.15 -0.20 0.41 #> off_rush_epa 0.03 -0.07 0.22 #> off_pass_epa -0.04 -0.05 0.36 #> def_rush_epa 0.27 0.05 -0.09 #> def_pass_epa 0.16 0.28 -0.19 #> prior_off_rush_epa 0.05 0.00 0.47 #> prior_off_pass_epa -0.01 -0.09 0.76 #> prior_def_rush_epa 1.00 0.32 -0.34 #> prior_def_pass_epa 0.32 1.00 -0.60 #> prior_point_diff -0.34 -0.60 1.00 message(\"2009 through 2019\") #> 2009 through 2019 data %>% filter(season >= 2009) %>% select(wins, point_diff, off_pass_epa, off_rush_epa, prior_point_diff, prior_off_pass_epa, prior_off_rush_epa) %>% cor(use=\"complete.obs\") %>% round(2) #> wins point_diff off_pass_epa off_rush_epa prior_point_diff #> wins 1.00 0.92 0.73 0.40 0.43 #> point_diff 0.92 1.00 0.79 0.46 0.44 #> off_pass_epa 0.73 0.79 1.00 0.37 0.38 #> off_rush_epa 0.40 0.46 0.37 1.00 0.19 #> prior_point_diff 0.43 0.44 0.38 0.19 1.00 #> prior_off_pass_epa 0.34 0.36 0.45 0.10 0.78 #> prior_off_rush_epa 0.24 0.25 0.17 0.24 0.45 #> prior_off_pass_epa prior_off_rush_epa #> wins 0.34 0.24 #> point_diff 0.36 0.25 #> off_pass_epa 0.45 0.17 #> off_rush_epa 0.10 0.24 #> prior_point_diff 0.78 0.45 #> prior_off_pass_epa 1.00 0.35 #> prior_off_rush_epa 0.35 1.00 message(\"1999 through 2008\") #> 1999 through 2008 data %>% filter(season < 2009) %>% select(wins, point_diff, off_pass_epa, off_rush_epa, prior_point_diff, prior_off_pass_epa, prior_off_rush_epa) %>% cor(use=\"complete.obs\") %>% round(2) #> wins point_diff off_pass_epa off_rush_epa prior_point_diff #> wins 1.00 0.92 0.68 0.47 0.28 #> point_diff 0.92 1.00 0.73 0.51 0.36 #> off_pass_epa 0.68 0.73 1.00 0.47 0.34 #> off_rush_epa 0.47 0.51 0.47 1.00 0.25 #> prior_point_diff 0.28 0.36 0.34 0.25 1.00 #> prior_off_pass_epa 0.23 0.29 0.45 0.30 0.74 #> prior_off_rush_epa 0.23 0.28 0.30 0.40 0.50 #> prior_off_pass_epa prior_off_rush_epa #> wins 0.23 0.23 #> point_diff 0.29 0.28 #> off_pass_epa 0.45 0.30 #> off_rush_epa 0.30 0.40 #> prior_point_diff 0.74 0.50 #> prior_off_pass_epa 1.00 0.48 #> prior_off_rush_epa 0.48 1.00 data <- data %>% filter(season >= 2009) fit <- lm(wins ~ prior_off_pass_epa + prior_off_rush_epa + prior_def_pass_epa + prior_def_rush_epa, data = data) summary(fit) #> #> Call: #> lm(formula = wins ~ prior_off_pass_epa + prior_off_rush_epa + #> prior_def_pass_epa + prior_def_rush_epa, data = data) #> #> Residuals: #> Min 1Q Median 3Q Max #> -7.7060 -1.8889 0.0678 2.2456 7.0869 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 7.9690 0.3883 20.524 < 0.0000000000000002 *** #> prior_off_pass_epa 6.5727 1.2784 5.141 0.000000438 *** #> prior_off_rush_epa 6.0275 2.2705 2.655 0.00827 ** #> prior_def_pass_epa -4.0837 1.6455 -2.482 0.01351 * #> prior_def_rush_epa -5.1531 2.3288 -2.213 0.02751 * #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> #> Residual standard error: 2.859 on 379 degrees of freedom #> (96 observations deleted due to missingness) #> Multiple R-squared: 0.164, Adjusted R-squared: 0.1552 #> F-statistic: 18.58 on 4 and 379 DF, p-value: 0.0000000000000584 fit2 <- lm(wins ~ prior_point_diff, data = data) summary(fit2) #> #> Call: #> lm(formula = wins ~ prior_point_diff, data = data) #> #> Residuals: #> Min 1Q Median 3Q Max #> -7.2007 -1.9624 0.1361 2.1952 7.3562 #> #> Coefficients: #> Estimate Std. Error t value Pr(>|t|) #> (Intercept) 8.097917 0.126658 63.94 <0.0000000000000002 *** #> prior_point_diff 0.012974 0.001254 10.35 <0.0000000000000002 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #> #> Residual standard error: 2.775 on 478 degrees of freedom #> Multiple R-squared: 0.183, Adjusted R-squared: 0.1813 #> F-statistic: 107.1 on 1 and 478 DF, p-value: < 0.00000000000000022"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"predictions","dir":"Articles","previous_headings":"Real life example: let’s make a win total model","what":"Predictions","title":"A beginner's guide to nflfastR","text":"Now let’s get predictions EPA model: mostly checks . just used simple point differential predict? surprisingly, looks pretty similar. basic models don’t incorporate schedule, roster changes, etc. example, better model take account Tom Brady longer playing Patriots. hopefully useful!","code":"preds <- predict(fit, data %>% filter(season == 2020)) %>% #was just a vector, need a tibble to bind as_tibble() %>% #make the column name make sense rename(prediction = value) %>% round(1) %>% #get names bind_cols( data %>% filter(season == 2020) %>% select(team) ) preds %>% arrange(-prediction) %>% head(5) #> # A tibble: 5 × 2 #> prediction team #> #> 1 11.5 BAL #> 2 10.2 SF #> 3 9.8 NE #> 4 9.6 DAL #> 5 9.6 NO preds2 <- predict(fit2, data %>% filter(season == 2020)) %>% #was just a vector, need a tibble to bind as_tibble() %>% #make the column name make sense rename(prediction = value) %>% round(1) %>% #get names bind_cols( data %>% filter(season == 2020) %>% select(team) ) preds2 %>% arrange(-prediction) %>% head(5) #> # A tibble: 5 × 2 #> prediction team #> #> 1 11.3 BAL #> 2 10.6 NE #> 3 10.3 SF #> 4 10 KC #> 5 9.6 DAL"},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"next-steps","dir":"Articles","previous_headings":"","what":"Next Steps","title":"A beginner's guide to nflfastR","text":"now know enough able tackle great deal questions using nflfastR data. good way build skills take interesting things see try replicate (making figures, also involve heavy dose googling stuff). Looking others’ code also good way learn. One option look nflfastR code base, much now understand ’s . example, function cleans data prepares later stages: ’s heavy dose mutate, group_by, arrange, lag, if_else, case_when.","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"resources-the-gold-standards","dir":"Articles","previous_headings":"Next Steps","what":"Resources: The gold standards","title":"A beginner's guide to nflfastR","text":"R package section pretty R heavy. Introduction R (recommended) Open Source Football: Mix R Python Mockup Blog (Thomas Mock): Invaluable resource making cool stuff R","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"code-examples-r","dir":"Articles","previous_headings":"Next Steps","what":"Code examples: R","title":"A beginner's guide to nflfastR","text":"Lee Sharpe: basic intro R RStudio Lee Sharpe: lots useful NFL / nflscrapR code Lee Sharpe: update current season games Josh Hermsmeyer: Getting Started R NFL Analysis Slavin: visualizing positional tiers SFB9 Ron Yurko: assorted examples CowboysStats: defensive playmaking EPA Michael Lopez: function sample plays Michael Lopez: R NFL analysis (presentation club staffers) Mitchell Wesson: QB hits investigation Mitchell Wesson: Investigation nflscrapR EP model WHoffman: graphs receivers (aDoT, success rate, ) ChiBearsStats: investigation 3rd downs vs offensive efficiency ChiBearsStats: insignificance field goal kicking","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"more-data-sources","dir":"Articles","previous_headings":"Next Steps","what":"More data sources","title":"A beginner's guide to nflfastR","text":"Lee Sharpe: Draft Picks, Draft Values, Games, Logos, Rosters, Standings greerre: get .csv file weather & stadium data PFR python Parker Fleming: Introduction College Football Data R cfbscrapR","code":""},{"path":"https://www.nflfastr.com/articles/beginners_guide.html","id":"other-code-examples-python","dir":"Articles","previous_headings":"Next Steps","what":"Other code examples: Python","title":"A beginner's guide to nflfastR","text":"Deryck97: nflfastR Python Guide Nick Wan: nflfastR Python Colab Guide Cory Jez: animated plot 903124S: Sampling EP 903124S: estimating EPA using nfldb 903124S: estimate EPA college football Blake Atkinson: explosiveness blog post python code Blake Atkinson: player type visualizations blog post python code","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"the-main-functions","dir":"Articles","previous_headings":"","what":"The Main Functions","title":"Get started with nflfastR","text":"nflfastR comes set functions access NFL play--play data team rosters. section provides brief introduction essential functions. nflfastR processes cleans play--play data adds variables ’s models. Since tasks performed separate functions, easiest way compute complete nflfastR dataset build_nflfastR_pbp(). main input function set game ids can accessed fast_scraper_schedules(). following code demonstrates build nflfastR dataset Super Bowls 2017 - 2019 seasons. cases, however, necessary use function individual games, nflfastR provides data repository two main play--play functions: load_pbp() update_db(). cover load_pbp() , please see Example 8: Using built-database function work database function update_db(). easiest way access data data repository new function load_pbp(). can load multiple seasons directly memory supports multiple data formats. Loading play--play data 2018-2020 seasons easy Joining roster data play--play data set possible well. data can accessed function fast_scraper_roster() application demonstrated Example 10: Working roster position data.","code":"library(nflfastR) library(dplyr, warn.conflicts = FALSE) ids <- nflfastR::fast_scraper_schedules(2017:2019) %>% dplyr::filter(game_type == \"SB\") %>% dplyr::pull(game_id) pbp <- nflfastR::build_nflfastR_pbp(ids) #> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.6.1.9007 ── #> • 11:10:05 | Start download of 3 games... #> ✔ 11:10:10 | Download finished. Adding variables... #> ✔ 11:10:10 | added game variables #> ✔ 11:10:11 | added nflscrapR variables #> [11:10:11] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> ✔ 11:10:11 | added ep variables #> ✔ 11:10:11 | added air_yac_ep variables #> [11:10:11] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> [11:10:11] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> ✔ 11:10:12 | added wp variables #> ✔ 11:10:12 | added air_yac_wp variables #> [11:10:12] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> ✔ 11:10:12 | added cp and cpoe #> ✔ 11:10:12 | added fixed drive variables #> ✔ 11:10:12 | added series variables #> • 11:10:12 | Cleaning up play-by-play... #> ✔ 11:10:12 | Cleaning completed #> ✔ 11:10:12 | added qb_epa #> • 11:10:12 | Computing xyac... #> [11:10:13] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> ✔ 11:10:15 | added xyac variables #> • 11:10:15 | Computing xpass... #> [11:10:15] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> ✔ 11:10:15 | added xpass and pass_oe #> • 11:10:15 | Decode player ids... #> ✔ 11:10:16 | Decoding of player ids completed #> ── DONE ──────────────────────────────────────────────────────────────────────── pbp <- nflfastR::load_pbp(2018:2020)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"application-examples","dir":"Articles","previous_headings":"","what":"Application Examples","title":"Get started with nflfastR","text":"examples listed assume following two libraries installed loaded.","code":"library(nflfastR) library(tidyverse)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-1-replicate-nflscrapr-with-fast_scraper","dir":"Articles","previous_headings":"Application Examples","what":"Example 1: replicate nflscrapR with fast_scraper","title":"Get started with nflfastR","text":"functionality nflscrapR can duplicated using fast_scraper(). obtains information contained nflscrapR (plus extra) much quickly. compare nflscrapR, use data repository program longer functions now NFL taken old Gamecenter feed. Note EP differs nflscrapR use newer era-adjusted model (post Open Source Football). example also uses built-function clean_pbp() create ‘name’ column primary player involved (QB pass play ball-carrier run play).","code":"readr::read_csv(\"https://github.com/ryurko/nflscrapR-data/blob/master/play_by_play_data/regular_season/reg_pbp_2019.csv?raw=true\") %>% dplyr::filter(home_team == \"SF\" & away_team == \"SEA\") %>% dplyr::select(desc, play_type, ep, epa, home_wp) %>% utils::head(6) %>% knitr::kable(digits = 3) nflfastR::fast_scraper(\"2019_10_SEA_SF\") %>% nflfastR::clean_pbp() %>% dplyr::select(desc, play_type, ep, epa, home_wp, name) %>% utils::head(6) %>% knitr::kable(digits = 3)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-2-scrape-a-batch-of-games-very-quickly-with-fast_scraper","dir":"Articles","previous_headings":"Application Examples","what":"Example 2: scrape a batch of games very quickly with fast_scraper","title":"Get started with nflfastR","text":"demonstration nflfastR’s capabilities. nflfastR can scrape batch games quickly, please respectful Github’s servers use data repository hosts scraped cleaned data whenever possible. reason ever actually use scraper ’s middle season haven’t updated repository recent games (automatically updated overnight every day).","code":"# get list of some games from 2019 games_2019 <- nflfastR::fast_scraper_schedules(2019) %>% utils::head(10) %>% dplyr::pull(game_id) tictoc::tic(glue::glue(\"{length(games_2019)} games with nflfastR:\")) f <- nflfastR::fast_scraper(games_2019) tictoc::toc() #> 10 games with nflfastR:: 7.634 sec elapsed"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-3-completion-percentage-over-expected-cpoe","dir":"Articles","previous_headings":"Application Examples","what":"Example 3: Completion Percentage Over Expected (CPOE)","title":"Get started with nflfastR","text":"Let’s look CPOE leaders 2009 regular season. discussed , nflfastR data repository old seasons, ’s need actually scrape . Let’s use convenience function load_pbp() fetches data repository (non-R users, .csv .parquet also available data repository).","code":"tictoc::tic(\"loading all games from 2009\") games_2009 <- nflfastR::load_pbp(2009) %>% dplyr::filter(season_type == \"REG\") tictoc::toc() #> loading all games from 2009: 2.278 sec elapsed games_2009 %>% dplyr::filter(!is.na(cpoe)) %>% dplyr::group_by(passer_player_name) %>% dplyr::summarize(cpoe = mean(cpoe), Atts = n()) %>% dplyr::filter(Atts > 200) %>% dplyr::arrange(-cpoe) %>% utils::head(5) %>% knitr::kable(digits = 1)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-4-using-drive-information","dir":"Articles","previous_headings":"Application Examples","what":"Example 4: Using Drive Information","title":"Get started with nflfastR","text":"working nflfastR, drive results automatically included. use fixed_drive fixed_drive_result since NFL-provided information bit wonky. Let’s look much likely teams score starting 1st & 10 20 yard line 2015 (last year touchbacks kickoffs changed 25) 2000. 20.6% 1st & 10 plays teams’ 20 see drive end score 2003, compared 30.5% 2015. implications Expected Points models (see article).","code":"pbp <- nflfastR::load_pbp(c(2003, 2015)) out <- pbp %>% dplyr::filter(season_type == \"REG\" & down == 1 & ydstogo == 10 & yardline_100 == 80) %>% dplyr::mutate(drive_score = dplyr::if_else(fixed_drive_result %in% c(\"Touchdown\", \"Field goal\"), 1, 0)) %>% dplyr::group_by(season) %>% dplyr::summarize(drive_score = mean(drive_score)) out %>% knitr::kable(digits = 3)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-5-plot-offensive-and-defensive-epa-per-play-for-a-given-season","dir":"Articles","previous_headings":"Application Examples","what":"Example 5: Plot offensive and defensive EPA per play for a given season","title":"Get started with nflfastR","text":"Let’s build NFL team tiers using offensive defensive expected points added per play 2005 regular season. Creating data viz including NFL team logos (wordmarks, headshots), recommend nflverse R package nflplotR. using load_pbp(), helper function clean_pbp() already run, creates “rush” “pass” columns () properly count sacks scrambles pass plays (b) properly include plays penalties. Using , can keep rush pass plays.","code":"library(nflplotR) pbp <- nflfastR::load_pbp(2005) %>% dplyr::filter(season_type == \"REG\") %>% dplyr::filter(!is.na(posteam) & (rush == 1 | pass == 1)) offense <- pbp %>% dplyr::group_by(team = posteam) %>% dplyr::summarise(off_epa = mean(epa, na.rm = TRUE)) defense <- pbp %>% dplyr::group_by(team = defteam) %>% dplyr::summarise(def_epa = mean(epa, na.rm = TRUE)) offense %>% dplyr::inner_join(defense, by = \"team\") %>% ggplot2::ggplot(aes(x = off_epa, y = def_epa)) + ggplot2::geom_abline(slope = -1.5, intercept = c(.4, .3, .2, .1, 0, -.1, -.2, -.3), alpha = .2) + nflplotR::geom_mean_lines(aes(y0 = off_epa, x0 = def_epa)) + nflplotR::geom_nfl_logos(aes(team_abbr = team), width = 0.07, alpha = 0.7) + ggplot2::labs( x = \"Offense EPA/play\", y = \"Defense EPA/play\", caption = \"Data: @nflfastR\", title = \"2005 NFL Offensive and Defensive EPA per Play\" ) + ggplot2::theme_bw() + ggplot2::theme( plot.title = ggplot2::element_text(size = 12, hjust = 0.5, face = \"bold\") ) + ggplot2::scale_y_reverse()"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-6-expected-points-calculator","dir":"Articles","previous_headings":"Application Examples","what":"Example 6: Expected Points calculator","title":"Get started with nflfastR","text":"provided calculator working Expected Points model. example use , looking Expected Points drive beginning following touchback changed time. put 'SEA' home_team posteam, matters figuring whether team ball home team (’s actual effect given team; matter team supplied). surprisingly, offenses become much successful time, kickoff touchback moving 20 25 2016 providing additional boost. Note td_prob example probability next score within half touchdown scored team ball, probability current drive end touchdown (numbers different Example 4 ). compare recent four years expectation playing dome inputting things changing roof input: 2018 2019, 1st & 10 home team’s 25 yard line higher EP domes home, expected.","code":"data <- tibble::tibble( \"season\" = 1999:2019, \"home_team\" = \"SEA\", \"posteam\" = \"SEA\", \"roof\" = \"outdoors\", \"half_seconds_remaining\" = 1800, \"yardline_100\" = c(rep(80, 17), rep(75, 4)), \"down\" = 1, \"ydstogo\" = 10, \"posteam_timeouts_remaining\" = 3, \"defteam_timeouts_remaining\" = 3 ) nflfastR::calculate_expected_points(data) %>% dplyr::select(season, yardline_100, td_prob, ep) %>% knitr::kable(digits = 2) data <- tibble::tibble( \"season\" = 2016:2019, \"week\" = 5, \"home_team\" = \"SEA\", \"posteam\" = \"SEA\", \"roof\" = \"dome\", \"half_seconds_remaining\" = 1800, \"yardline_100\" = c(rep(75, 4)), \"down\" = 1, \"ydstogo\" = 10, \"posteam_timeouts_remaining\" = 3, \"defteam_timeouts_remaining\" = 3 ) nflfastR::calculate_expected_points(data) %>% dplyr::select(season, yardline_100, td_prob, ep) %>% knitr::kable(digits = 2)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-7-win-probability-calculator","dir":"Articles","previous_headings":"Application Examples","what":"Example 7: Win probability calculator","title":"Get started with nflfastR","text":"also provided calculator working win probability models. example use , looking win probability begin game depends pre-game spread. put 'SEA' home_team posteam, matters figuring whether team ball home team (’s actual effect given team; matter team supplied). surprisingly, vegas_wp increases amount team coming game favored .","code":"data <- tibble::tibble( \"receive_2h_ko\" = 0, \"home_team\" = \"SEA\", \"posteam\" = \"SEA\", \"score_differential\" = 0, \"half_seconds_remaining\" = 1800, \"game_seconds_remaining\" = 3600, \"spread_line\" = c(1, 3, 4, 7, 14), \"down\" = 1, \"ydstogo\" = 10, \"yardline_100\" = 75, \"posteam_timeouts_remaining\" = 3, \"defteam_timeouts_remaining\" = 3 ) nflfastR::calculate_win_probability(data) %>% dplyr::select(spread_line, wp, vegas_wp) %>% knitr::kable(digits = 2)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-8-using-the-built-in-database-function","dir":"Articles","previous_headings":"Application Examples","what":"Example 8: Using the built-in database function","title":"Get started with nflfastR","text":"’re comfortable using dplyr functions manipulate tidy data, ’re ready use database. use database? provided function nflfastR makes extremely easy build database keep updated Play--play data 20+ seasons takes lot memory: working database allows bring memory actually need R makes extremely easy work databases.","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"start-install-and-load-packages","dir":"Articles","previous_headings":"Application Examples > Example 8: Using the built-in database function","what":"Start: install and load packages","title":"Get started with nflfastR","text":"start, need install two packages required aren’t installed automatically nflfastR installs: DBI RSQLite (advanced users can use types databases, example use SQLite). statements make sure packages won’t updated already installed: always, need install . don’t need loaded build database nflfastR knows use , need later working database.","code":"if (!require(\"DBI\")) install.packages(\"DBI\") if (!require(\"RSQLite\")) install.packages(\"RSQLite\") library(DBI) library(RSQLite)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"build-database","dir":"Articles","previous_headings":"Application Examples > Example 8: Using the built-in database function","what":"Build database","title":"Get started with nflfastR","text":"’s exactly one function nflfastR works databases: update_db(). notes: use update_db() arguments, build SQLite database called pbp_db current working directory, play--play data table called nflfastR_pbp. can specify different directory dbdir. can specify different filename dbname. can specify different table name tblname. want rebuild database scratch whatever reason, supply force_rebuild = TRUE. primarily intended case update play--play data data repo due fixing bug want force database wiped updated. want rebuild specified seasons, can also supplied force_rebuild (e.g. force_rebuild = c(2019, 2020)). parameter db_connection intended advanced users want use DBI drivers, MariaDB, Postgres odbc. Please note dbdir dbname dropped db_connection provided argument tblname still used write data table database. Let’s say just want dump database current working directory. go! created database current directory called pbp_db. Wait, ’s ? ’s ! ’s partway season want make sure new games added database? run? update_db()! (just make sure ’re directory database saved supply right file path) ’s partway season want re-build season allow data corrections NFL propagate database, can specify one season rebuilt:","code":"nflfastR::update_db() #> ── Update nflfastR Play-by-Play Database ──────── nflfastR version 4.6.1.9007 ── #> ℹ 11:11:05 | Can't find the data table \"nflfastR_pbp\" #> in your database. Will load the play by play data from #> scratch. #> • 11:11:05 | Starting download of 25 seasons between 1999 and 2023... #> • 11:12:27 | Checking for missing completed games... #> ℹ 11:12:28 | You have 6703 games and are missing 0. #> ✔ 11:12:29 | Database update completed #> ℹ 11:12:29 | Path to your db: ./pbp_db #> ── DONE ──────────────────────────────────────────────────────────────────────── nflfastR::update_db() #> ── Update nflfastR Play-by-Play Database ──────── nflfastR version 4.6.1.9007 ── #> • 11:12:29 | Checking for missing completed games... #> ℹ 11:12:29 | You have 6703 games and are missing 0. #> ✔ 11:12:30 | Database update completed #> ℹ 11:12:30 | Path to your db: /home/runner/work/nflfastR/nflfastR/vignettes/pbp_db #> ── DONE ──────────────────────────────────────────────────────────────────────── nflfastR::update_db(force_rebuild = 2020) #> ── Update nflfastR Play-by-Play Database ──────── nflfastR version 4.6.1.9007 ── #> • 11:12:30 | Purging season 2020 from the data table \"nflfastR_pbp\" in your #> connected database... #> • 11:12:31 | Starting download of the 1 season 2020 #> • 11:12:34 | Checking for missing completed games... #> ℹ 11:12:35 | You have 6703 games and are missing 0. #> ✔ 11:12:35 | Database update completed #> ℹ 11:12:35 | Path to your db: /home/runner/work/nflfastR/nflfastR/vignettes/pbp_db #> ── DONE ────────────────────────────────────────────────────────────────────────"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"connect-to-database","dir":"Articles","previous_headings":"Application Examples > Example 8: Using the built-in database function","what":"Connect to database","title":"Get started with nflfastR","text":"Now can make connection database. part look little bit foreign, need know database located. ’s current working directory, work: looks like nothing happened, now connection database. Now ’re ready stuff. aren’t familiar databases, ’re organized around tables. ’s see tables present database: Since went defaults, ’s table called nflfastR_pbp. Another useful function see fields (.e., columns) table: list list columns nflfastR play--play. Notice supply name table (\"nflfastR_pbp\"). way, ’s couple things learn. main driver tbl, helps get output specific table database: now, everything magically just “work”: can forget ’re even working database! far, everything stayed database. want bring query memory, just use collect() end: ’ve searched 1 million rows data across 300+ columns brought 6950 rows two columns memory. Pretty neat! supply data shiny apps rbsdm.com without running memory server. Now ’s one thing remember. ’re finished need database: details using database nflfastR, see Thomas Mock’s life-changing post . detailed information dbplyr (dplyr database back-end) given second edition Hadley Wickham’s R Data Science (2e).","code":"connection <- DBI::dbConnect(RSQLite::SQLite(), \"./pbp_db\") connection #> #> Path: /home/runner/work/nflfastR/nflfastR/vignettes/pbp_db #> Extensions: TRUE DBI::dbListTables(connection) #> [1] \"nflfastR_pbp\" DBI::dbListFields(connection, \"nflfastR_pbp\") %>% utils::head(10) #> [1] \"play_id\" \"game_id\" \"old_game_id\" \"home_team\" \"away_team\" #> [6] \"season_type\" \"week\" \"posteam\" \"posteam_type\" \"defteam\" pbp_db <- dplyr::tbl(connection, \"nflfastR_pbp\") pbp_db %>% dplyr::group_by(season) %>% dplyr::summarize(n = dplyr::n()) #> # Source: SQL [?? x 2] #> # Database: sqlite 3.45.0 [/home/runner/work/nflfastR/nflfastR/vignettes/pbp_db] #> season n #> #> 1 1999 46136 #> 2 2000 45491 #> 3 2001 44969 #> 4 2002 47355 #> 5 2003 46810 #> 6 2004 46706 #> 7 2005 46823 #> 8 2006 46299 #> 9 2007 46266 #> 10 2008 45917 #> # ℹ more rows pbp_db %>% dplyr::filter(rush == 1 | pass == 1, down <= 2, !is.na(epa), !is.na(posteam)) %>% dplyr::group_by(pass) %>% dplyr::summarize(mean_epa = mean(epa, na.rm = TRUE)) #> # Source: SQL [2 x 2] #> # Database: sqlite 3.45.0 [/home/runner/work/nflfastR/nflfastR/vignettes/pbp_db] #> pass mean_epa #> #> 1 0 -0.0977 #> 2 1 0.0733 russ <- pbp_db %>% dplyr::filter(name == \"R.Wilson\" & posteam == \"SEA\") %>% dplyr::select(desc, epa) %>% dplyr::collect() russ #> # A tibble: 6,946 × 2 #> desc epa #> #> 1 (14:12) 3-R.Wilson pass short right to 18-S.Rice to SEA 34 for 9 yar… 1.13 #> 2 (12:53) 3-R.Wilson pass incomplete deep left to 18-S.Rice. PENALTY o… 2.68 #> 3 (11:25) (Shotgun) 3-R.Wilson pass incomplete short right to 18-S.Ric… -1.31 #> 4 (10:24) (Shotgun) 3-R.Wilson pass short left to 18-S.Rice to ARI 31 … 0.928 #> 5 (9:47) 3-R.Wilson scrambles right end ran ob at ARI 27 for 4 yards (… -0.0194 #> 6 (8:35) 3-R.Wilson pass incomplete short right to 18-S.Rice. -0.426 #> 7 (7:54) (Shotgun) 3-R.Wilson left end pushed ob at ARI 9 for 4 yards … -1.17 #> 8 (:27) 3-R.Wilson sacked at SEA 17 for -5 yards (51-P.Lenon). Penalty… -1.13 #> 9 (14:28) (Shotgun) 3-R.Wilson pass short right to 17-B.Edwards to SEA… 1.94 #> 10 (13:59) 3-R.Wilson pass incomplete deep left to 87-B.Obomanu. -0.453 #> # ℹ 6,936 more rows DBI::dbDisconnect(connection)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-9-working-with-the-expected-yards-after-catch-model","dir":"Articles","previous_headings":"Application Examples","what":"Example 9: working with the expected yards after catch model","title":"Get started with nflfastR","text":"variables xyac follows: xyac_epa: expected value EPA gained catch, starting catch made. xyac_success: probability play earns positive EPA (relative play started) based ball caught. xyac_fd: Probability play earns first based ball caught. xyac_mean_yardage xyac_median_yardage: Average median expected yards catch based ball caught. notes: epa = air_epa + yac_epa, air_epa EPA associated catch target location. receiver loses fumble, removed yac_epa Expected value EPA catch point = air_epa + xyac_epa want get YAC EPA expected, need compare yac_epa xyac_epa, example get first downs expected, compare first_down xyac_fd fields populated pass attempts, whether caught , restrict completed passes measuring, example, YAC EPA expected expected YAC EPA model doesn’t take receiver fumbles account, actual minus expected YAC slightly negative due fumbles happening Let’s create measures EPA first downs expected 2015: presence many running backs list suggests even though takes account target depth pass direction, model doesn’t great job capturing space. Alternatively, running backs might better generating yards catch since running football primary role.","code":"nflfastR::load_pbp(2015) %>% dplyr::group_by(receiver, receiver_id, posteam) %>% dplyr::mutate(tgt = sum(complete_pass + incomplete_pass)) %>% dplyr::filter(tgt >= 50) %>% dplyr::filter(complete_pass == 1, air_yards < yardline_100, !is.na(xyac_epa)) %>% dplyr::summarize( epa_oe = mean(yac_epa - xyac_epa), actual_fd = mean(first_down), expected_fd = mean(xyac_fd), fd_oe = mean(first_down - xyac_fd), rec = dplyr::n() ) %>% dplyr::ungroup() %>% dplyr::select(receiver, posteam, actual_fd, expected_fd, fd_oe, epa_oe, rec) %>% dplyr::arrange(-epa_oe) %>% utils::head(10) %>% knitr::kable(digits = 3)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-10-working-with-roster-and-position-data","dir":"Articles","previous_headings":"Application Examples","what":"Example 10: Working with roster and position data","title":"Get started with nflfastR","text":"long last, ’s way merge new play--play data roster information. Use function get rosters: Now let’s load play--play data 2019: player IDs look like nflfastR now automatically decodes IDs look like old format GSIS IDs: Now ’re ready join roster data using IDs: surprisingly, 5 top 5 WRs terms EPA added come ahead top RB. Note number targets won’t match official stats ’re including plays penalties.","code":"roster <- nflfastR::fast_scraper_roster(2019) games_2019 <- nflfastR::load_pbp(2019) games_2019 %>% dplyr::filter(rush == 1 | pass == 1, posteam == \"SEA\") %>% dplyr::select(name, id) #> ── nflverse play by play data ────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-07 14:39:28 UTC #> # A tibble: 1,207 × 2 #> name id #> #> 1 C.Carson 00-0033594 #> 2 R.Wilson 00-0029263 #> 3 R.Wilson 00-0029263 #> 4 C.Carson 00-0033594 #> 5 R.Wilson 00-0029263 #> 6 C.Carson 00-0033594 #> 7 R.Wilson 00-0029263 #> 8 C.Carson 00-0033594 #> 9 R.Wilson 00-0029263 #> 10 R.Wilson 00-0029263 #> # ℹ 1,197 more rows joined <- games_2019 %>% dplyr::filter(!is.na(receiver_id)) %>% dplyr::select(posteam, season, desc, receiver, receiver_id, epa) %>% dplyr::left_join(roster, by = c(\"receiver_id\" = \"gsis_id\")) # the real work is done, this just makes a table and has it look nice joined %>% dplyr::filter(position %in% c(\"WR\", \"TE\", \"RB\")) %>% dplyr::group_by(receiver_id, receiver, position) %>% dplyr::summarize(tot_epa = sum(epa), n = n()) %>% dplyr::arrange(-tot_epa) %>% dplyr::ungroup() %>% dplyr::group_by(position) %>% dplyr::mutate(position_rank = 1:n()) %>% dplyr::filter(position_rank <= 5) %>% dplyr::rename(Pos_Rank = position_rank, Player = receiver, Pos = position, Tgt = n, EPA = tot_epa) %>% dplyr::select(Player, Pos, Pos_Rank, Tgt, EPA) %>% knitr::kable(digits = 0)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"example-11-replicating-official-stats","dir":"Articles","previous_headings":"Application Examples","what":"Example 11: Replicating official stats","title":"Get started with nflfastR","text":"columns like name, passer, fantasy etc nflfastR-created columns mimic “real” football: .e., excluding plays spikes, counting scrambles sacks pass plays, etc. ’re trying replicate official statistics – perhaps fantasy purposes – use *_player_name *_player_id columns.","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"leaderboards","dir":"Articles","previous_headings":"Application Examples > Example 11: Replicating official stats","what":"Leaderboards","title":"Get started with nflfastR","text":"Let’s try replicate page passing leaders. match official stats NFL.com (note filter season_type == \"REG\" since official stats count regular season games). Note ’re using passing_yards yards_gained equal passing yards plays laterals. works, ’ve also provided function : calculate_player_stats(). function takes nflfastR play--play dataframe input along one argument, weekly, defaults FALSE. weekly true, week--week dataframe returned (rather aggregate whole provided dataframe). Let’s replicate top 10 players passing yards: can rush attempts replicate NFL leaderboard: , matches exactly.","code":"nflfastR::load_pbp(2020) %>% dplyr::filter(season_type == \"REG\", complete_pass == 1 | incomplete_pass == 1 | interception == 1, !is.na(down)) %>% dplyr::group_by(passer_player_name, posteam) %>% dplyr::summarize( yards = sum(passing_yards, na.rm = T), tds = sum(touchdown == 1 & td_team == posteam), ints = sum(interception), att = dplyr::n() ) %>% dplyr::arrange(-yards) %>% utils::head(10) %>% knitr::kable(digits = 0) nflfastR::load_pbp(2020) %>% dplyr::filter(season_type == \"REG\") %>% nflfastR::calculate_player_stats() %>% dplyr::arrange(-passing_yards) %>% dplyr::select(player_name, recent_team, completions, attempts, passing_yards, passing_tds, interceptions) %>% utils::head(10) %>% knitr::kable(digits = 0) nflfastR::load_pbp(2020) %>% dplyr::filter(season_type == \"REG\") %>% nflfastR::calculate_player_stats() %>% dplyr::arrange(-rushing_yards) %>% dplyr::select(player_name, recent_team, carries, rushing_yards, rushing_tds, rushing_fumbles_lost) %>% utils::head(10) %>% knitr::kable(digits = 0)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"yards-from-scrimmage","dir":"Articles","previous_headings":"Application Examples > Example 11: Replicating official stats","what":"Yards from scrimmage","title":"Get started with nflfastR","text":"want total yards scrimmage? ’ll demonstrate three methods . hardest way use fantasy_player_name column, rusher rush plays receiver receiving plays: Looking PFR scrimmage stats, columns exact match. also just use calculate_player_stats() : get thing. third way use load_player_stats() function, can load data frame player-level stats every week since 1999. output identical.","code":"nflfastR::load_pbp(2020) %>% dplyr::filter(season_type == \"REG\", !is.na(down)) %>% dplyr::group_by(fantasy_player_name, posteam) %>% dplyr::summarize( carries = sum(rush_attempt), receptions = sum(complete_pass), touches = sum(rush_attempt + complete_pass), yards = sum(yards_gained), tds = sum(touchdown == 1 & td_team == posteam) ) %>% dplyr::arrange(-yards) %>% utils::head(10) %>% knitr::kable(digits = 0) nflfastR::load_pbp(2020) %>% dplyr::filter(season_type == \"REG\") %>% nflfastR::calculate_player_stats() %>% dplyr::mutate( yards = rushing_yards + receiving_yards, touches = carries + receptions, tds = rushing_tds + receiving_tds ) %>% dplyr::arrange(-yards) %>% dplyr::select(player_name, recent_team, carries, receptions, touches, yards, tds) %>% utils::head(10) %>% knitr::kable(digits = 0) nflfastR::load_player_stats(seasons = 2020) %>% dplyr::filter(season_type == \"REG\") %>% dplyr::group_by(player_id) %>% dplyr::summarize( player_name = dplyr::first(player_name), recent_team = dplyr::first(recent_team), yards = sum(rushing_yards + receiving_yards), touches = sum(carries + receptions), carries = sum(carries), receptions = sum(receptions), tds = sum(rushing_tds + receiving_tds) ) %>% dplyr::ungroup() %>% dplyr::arrange(-yards) %>% dplyr::select(player_name, recent_team, carries, receptions, touches, yards, tds) %>% utils::head(10) %>% knitr::kable(digits = 0)"},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"fantasy-points","dir":"Articles","previous_headings":"Application Examples > Example 11: Replicating official stats","what":"Fantasy points","title":"Get started with nflfastR","text":"Let’s calculate PPR fantasy points per game first 16 weeks season among wide receivers appeared 5 games. Comparing FantasyPros website, exact match.","code":"nflfastR::load_pbp(2020) %>% dplyr::filter(week <= 16) %>% nflfastR::calculate_player_stats() %>% dplyr::mutate( ppg = fantasy_points_ppr / games ) %>% dplyr::filter(games > 5) %>% # only keep the WRs dplyr::inner_join( nflfastR::fast_scraper_roster(2020) %>% dplyr::filter(position == \"WR\") %>% dplyr::select(player_id = gsis_id), by = \"player_id\" ) %>% dplyr::arrange(-ppg) %>% dplyr::select(player_name, recent_team, games, fantasy_points_ppr, ppg) %>% utils::head(10) %>% knitr::kable(digits = 1)"},{"path":[]},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"the-drive-column-looks-wacky","dir":"Articles","previous_headings":"Frequent issues","what":"The drive column looks wacky","title":"Get started with nflfastR","text":"Use fixed_drive fixed_drive_result instead. See Example 4: Using Drive Information.","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"why-are-there-so-many-win-probability-columns","dir":"Articles","previous_headings":"Frequent issues","what":"Why are there so many win probability columns?","title":"Get started with nflfastR","text":"vegas_wp vegas_home_wp incorporate pregame spread much better models.","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"im-trying-to-do-x--help","dir":"Articles","previous_headings":"Frequent issues","what":"I’m trying to do X. Help!","title":"Get started with nflfastR","text":"Please ask Discord channel.","code":""},{"path":"https://www.nflfastr.com/articles/nflfastR.html","id":"links","dir":"Articles","previous_headings":"","what":"Links","title":"Get started with nflfastR","text":"section helper holds hyperlinks chapters. ’s workaround missing sections anchor bug pkgdown hopefully fixed pull request point future. Main Functions Example 1: replicate nflscrapR fast_scraper Example 2: scrape batch games quickly fast_scraper Example 3: Completion Percentage Expected (CPOE) Example 4: Using Drive Information Example 5: Plot offensive defensive EPA per play given season Example 6: Expected Points calculator Example 7: Win probability calculator Example 8: Using built-database function Example 9: working expected yards catch model Example 10: Working roster position data Example 11: Replicating official stats Frequent issues Links","code":""},{"path":"https://www.nflfastr.com/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Sebastian Carl. Author. Ben Baldwin. Maintainer, author. Lee Sharpe. Contributor. Maksim Horowitz. Contributor. Ron Yurko. Contributor. Samuel Ventura. Contributor. Tan Ho. Contributor. John Edwards. Contributor.","code":""},{"path":"https://www.nflfastr.com/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Carl S, Baldwin B (2024). nflfastR: Functions Efficiently Access NFL Play Play Data. R package version 4.6.1.9007, https://github.com/nflverse/nflfastR, https://www.nflfastr.com/.","code":"@Manual{, title = {nflfastR: Functions to Efficiently Access NFL Play by Play Data}, author = {Sebastian Carl and Ben Baldwin}, year = {2024}, note = {R package version 4.6.1.9007, https://github.com/nflverse/nflfastR}, url = {https://www.nflfastr.com/}, }"},{"path":"https://www.nflfastr.com/index.html","id":"nflfastr-","dir":"","previous_headings":"","what":"An R package to quickly obtain clean and tidy NFL play by play data","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"nflfastR set functions efficiently scrape NFL play--play data. nflfastR expands upon features nflscrapR: package contains NFL play--play data back 1999 suggested package name, obtains games much faster Includes completion probability (cp), completion percentage expected (cpoe), expected yards catch (xyac_epa xyac_mean_yardage) play--play going back 2006 Includes drive information, including drive starting position drive result Includes series information, including series number series success Hosts repository play--play data going back 1999 quick access Features models Expected Points, Win Probability, Completion Probability, Yards Catch (see section ) Includes function update_db() creates updates database owe debt gratitude original nflscrapR team, Maksim Horowitz, Ronald Yurko, Samuel Ventura, without whose contributions inspiration package exist.","code":""},{"path":"https://www.nflfastr.com/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"easiest way get nflfastR install CRAN : get bug fix use feature development version, can install development version nflfastR either GitHub : prebuilt development repo :","code":"install.packages(\"nflfastR\") if (!require(\"pak\")) install.packages(\"pak\") pak::pak(\"nflverse/nflfastR\") install.packages(\"nflfastR\", repos = c(\"https://nflverse.r-universe.dev\", getOption(\"repos\")))"},{"path":"https://www.nflfastr.com/index.html","id":"usage","dir":"","previous_headings":"","what":"Usage","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"provided application examples Getting Started article. However, require basic knowledge R. reason nflfastR beginner’s guide, recommend looking introduction nflfastR R. can find column names descriptions Field Descriptions article, accessing field_descriptions dataframe package.","code":""},{"path":"https://www.nflfastr.com/index.html","id":"data-access","dir":"","previous_headings":"","what":"Data access","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"Even though nflfastR fast, recommend downloading data using nflreadr package. data sets include play--play data complete seasons going back 1999 updated nightly season. files contain regular season postseason data, one can use game_type week figure games occurred postseason.","code":""},{"path":"https://www.nflfastr.com/index.html","id":"nflfastr-models","dir":"","previous_headings":"","what":"nflfastR models","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"nflfastR uses models Expected Points, Win Probability, Completion Probability, Expected Yards Catch. read models, please see post Open Source Football. detailed description motivation Expected Points models, highly recommend paper nflscrapR team located . visualization Expected Points model yardline. visualization Completion Probability model air yards pass direction. nflfastR includes two win probability models: one one without incorporating pre-game spread.","code":""},{"path":"https://www.nflfastr.com/index.html","id":"special-thanks","dir":"","previous_headings":"","what":"Special thanks","title":"An R package to quickly obtain clean and tidy NFL play by play data","text":"Nick Shoemaker finding making available JSON-formatted NFL play--play back 1999 (nflfastR uses source 1999 2000 previously also used 2001-2010) Lau Sze Yui developing scraping function access JSON-formatted NFL play--play beginning 2001 Aaron Schatz Football Outsiders providing charting data correctly mark scrambles 2005 season Lee Sharpe curating resource game information Timo Riske, Lau Sze Yui, Sean Clement, Daniel Houston many helpful discussions regarding development new nflfastR models Zach Feldman Josh Hermsmeyer many helpful discussions CPOE models well Peter Owen many helpful suggestions CP model Florian Schmitt logo design many users found reported bugs nflfastR 1.0 course, original nflscrapR team, Maksim Horowitz, Ronald Yurko, Samuel Ventura, whose work represented dramatic step forward state public NFL research","code":""},{"path":"https://www.nflfastr.com/reference/add_qb_epa.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute QB epa — add_qb_epa","title":"Compute QB epa — add_qb_epa","text":"Compute QB epa","code":""},{"path":"https://www.nflfastr.com/reference/add_qb_epa.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute QB epa — add_qb_epa","text":"","code":"add_qb_epa(pbp, ...)"},{"path":"https://www.nflfastr.com/reference/add_qb_epa.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute QB epa — add_qb_epa","text":"pbp Data frame play--play data scraped using fast_scraper(). ... Additional arguments passed message function (internal use).","code":""},{"path":"https://www.nflfastr.com/reference/add_qb_epa.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute QB epa — add_qb_epa","text":"Add variable 'qb_epa', gives QB credit EPA point receiver lost fumble completed catch makes EPA work like passing yards plays fumbles","code":""},{"path":"https://www.nflfastr.com/reference/add_xpass.html","id":null,"dir":"Reference","previous_headings":"","what":"Add expected pass columns — add_xpass","title":"Add expected pass columns — add_xpass","text":"Build columns expected dropback model. return NA data prior 2006 since NFL started marking scrambles. Must run dataframe already clean_pbp() run . Note functions build_nflfastR_pbp() database function update_db() already include function.","code":""},{"path":"https://www.nflfastr.com/reference/add_xpass.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add expected pass columns — add_xpass","text":"","code":"add_xpass(pbp, ...)"},{"path":"https://www.nflfastr.com/reference/add_xpass.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add expected pass columns — add_xpass","text":"pbp Data frame play--play data scraped using fast_scraper(). ... Additional arguments passed message function (internal use).","code":""},{"path":"https://www.nflfastr.com/reference/add_xpass.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add expected pass columns — add_xpass","text":"input Data Frame parameter pbp following columns added: xpass Probability dropback scaled 0 1. pass_oe Dropback percent expected given play scaled 0 100.","code":""},{"path":"https://www.nflfastr.com/reference/add_xyac.html","id":null,"dir":"Reference","previous_headings":"","what":"Add expected yards after completion (xyac) variables — add_xyac","title":"Add expected yards after completion (xyac) variables — add_xyac","text":"Add expected yards completion (xyac) variables","code":""},{"path":"https://www.nflfastr.com/reference/add_xyac.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add expected yards after completion (xyac) variables — add_xyac","text":"","code":"add_xyac(pbp, ...)"},{"path":"https://www.nflfastr.com/reference/add_xyac.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add expected yards after completion (xyac) variables — add_xyac","text":"pbp Data frame play--play data scraped using fast_scraper(). ... Additional arguments passed message function (internal use).","code":""},{"path":"https://www.nflfastr.com/reference/add_xyac.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add expected yards after completion (xyac) variables — add_xyac","text":"input Data Frame parameter 'pbp' following columns added: xyac_epa Expected value EPA gained catch, starting catch made. Zero yards catch listed zero EPA. xyac_success Probability play earns positive EPA (relative play started) based ball caught. xyac_fd Probability play earns first based ball caught. xyac_mean_yardage Average expected yards catch based ball caught. xyac_median_yardage Median expected yards catch based ball caught.","code":""},{"path":"https://www.nflfastr.com/reference/add_xyac.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add expected yards after completion (xyac) variables — add_xyac","text":"Build columns capture expect catch.","code":""},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":null,"dir":"Reference","previous_headings":"","what":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"build_nflfastR_pbp convenient wrapper around 6 nflfastR functions: fast_scraper() clean_pbp() add_qb_epa() add_xyac() add_xpass() decode_player_ids() Please see either documentation function nflfastR Field Descriptions website learn output.","code":""},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"","code":"build_nflfastR_pbp( game_ids, dir = getOption(\"nflfastR.raw_directory\", default = NULL), ..., decode = TRUE, rules = TRUE )"},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"game_ids Vector character ids data frame including variable game_id (see details information). dir Path local directory (defaults option \"nflfastR.raw_directory\") nflfastR searches raw game play--play data. See save_raw_pbp() additional information. ... Additional arguments passed scraping functions (internal use) decode TRUE, function decode_player_ids() executed. rules FALSE, printing header footer console output suppressed.","code":""},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"nflfastR play--play data frame like can loaded https://github.com/nflverse/nflverse-data.","code":""},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"load valid game_ids please use package function fast_scraper_schedules().","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/build_nflfastR_pbp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Build a Complete nflfastR Data Set — build_nflfastR_pbp","text":"","code":"# \\donttest{ # Build nflfastR pbp for the 2018 and 2019 Super Bowls try({# to avoid CRAN test problems build_nflfastR_pbp(c(\"2018_21_NE_LA\", \"2019_21_SF_KC\")) }) #> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.6.1.9007 ── #> • 11:06:42 | Start download of 2 games... #> ℹ It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan(\"multisession\")`! Will go on sequentially... #> ✔ 11:06:44 | Download finished. Adding variables... #> ✔ 11:06:45 | added game variables #> ✔ 11:06:45 | added nflscrapR variables #> [11:06:45] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> ✔ 11:06:46 | added ep variables #> ✔ 11:06:46 | added air_yac_ep variables #> [11:06:46] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> [11:06:46] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> ✔ 11:06:46 | added wp variables #> ✔ 11:06:46 | added air_yac_wp variables #> [11:06:46] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> ✔ 11:06:46 | added cp and cpoe #> ✔ 11:06:46 | added fixed drive variables #> ✔ 11:06:46 | added series variables #> • 11:06:46 | Cleaning up play-by-play... #> ✔ 11:06:46 | Cleaning completed #> ✔ 11:06:46 | added qb_epa #> • 11:06:46 | Computing xyac... #> [11:06:48] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> ✔ 11:06:48 | added xyac variables #> • 11:06:48 | Computing xpass... #> [11:06:49] WARNING: src/learner.cc:553: #> If you are loading a serialized model (like pickle in Python, RDS in R) generated by #> older XGBoost, please export the model by calling `Booster.save_model` from that version #> first, then load it back in current version. See: #> #> https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html #> #> for more details about differences between saving model and serializing. #> #> ✔ 11:06:49 | added xpass and pass_oe #> • 11:06:49 | Decode player ids... #> ✔ 11:06:50 | Decoding of player ids completed #> ── DONE ──────────────────────────────────────────────────────────────────────── #> ── nflverse play by play ─────────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 11:06:50 UTC #> # A tibble: 349 × 372 #> play_id game_id old_game_id home_team away_team season_type week posteam #> #> 1 1 2018_21_NE… 2019020300 LA NE POST 21 NA #> 2 38 2018_21_NE… 2019020300 LA NE POST 21 NE #> 3 67 2018_21_NE… 2019020300 LA NE POST 21 NE #> 4 89 2018_21_NE… 2019020300 LA NE POST 21 NE #> 5 111 2018_21_NE… 2019020300 LA NE POST 21 NE #> 6 133 2018_21_NE… 2019020300 LA NE POST 21 NE #> 7 155 2018_21_NE… 2019020300 LA NE POST 21 NE #> 8 182 2018_21_NE… 2019020300 LA NE POST 21 LA #> 9 204 2018_21_NE… 2019020300 LA NE POST 21 LA #> 10 226 2018_21_NE… 2019020300 LA NE POST 21 LA #> # ℹ 339 more rows #> # ℹ 364 more variables: posteam_type , defteam , side_of_field , #> # yardline_100 , game_date , quarter_seconds_remaining , #> # half_seconds_remaining , game_seconds_remaining , #> # game_half , quarter_end , drive , sp , qtr , #> # down , goal_to_go , time , yrdln , ydstogo , #> # ydsnet , desc , play_type , yards_gained , … # It is also possible to directly use the # output of `fast_scraper_schedules` as input try({# to avoid CRAN test problems library(dplyr, warn.conflicts = FALSE) fast_scraper_schedules(2020) %>% slice_tail(n = 3) %>% build_nflfastR_pbp() }) #> ── Build nflfastR Play-by-Play Data ───────────── nflfastR version 4.6.1.9007 ── #> • 11:06:50 | Start download of 3 games... #> ℹ It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan(\"multisession\")`! Will go on sequentially... #> ✔ 11:06:52 | Download finished. Adding variables... #> ✔ 11:06:52 | added game variables #> ✔ 11:06:53 | added nflscrapR variables #> ✔ 11:06:53 | added ep variables #> ✔ 11:06:53 | added air_yac_ep variables #> ✔ 11:06:53 | added wp variables #> ✔ 11:06:53 | added air_yac_wp variables #> ✔ 11:06:53 | added cp and cpoe #> ✔ 11:06:53 | added fixed drive variables #> ✔ 11:06:53 | added series variables #> • 11:06:53 | Cleaning up play-by-play... #> ✔ 11:06:54 | Cleaning completed #> ✔ 11:06:54 | added qb_epa #> • 11:06:54 | Computing xyac... #> ✔ 11:06:55 | added xyac variables #> • 11:06:55 | Computing xpass... #> ✔ 11:06:55 | added xpass and pass_oe #> • 11:06:55 | Decode player ids... #> ✔ 11:06:55 | Decoding of player ids completed #> ── DONE ──────────────────────────────────────────────────────────────────────── #> ── nflverse play by play ─────────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 11:06:55 UTC #> # A tibble: 539 × 372 #> play_id game_id old_game_id home_team away_team season_type week posteam #> #> 1 1 2020_20_BU… 2021012401 KC BUF POST 20 NA #> 2 42 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 3 57 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 4 78 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 5 102 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 6 123 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 7 145 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 8 174 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 9 207 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 10 236 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> # ℹ 529 more rows #> # ℹ 364 more variables: posteam_type , defteam , side_of_field , #> # yardline_100 , game_date , quarter_seconds_remaining , #> # half_seconds_remaining , game_seconds_remaining , #> # game_half , quarter_end , drive , sp , qtr , #> # down , goal_to_go , time , yrdln , ydstogo , #> # ydsnet , desc , play_type , yards_gained , … # \\dontshow{ # Close open connections for R CMD Check future::plan(\"sequential\") # } # }"},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute expected points — calculate_expected_points","title":"Compute expected points — calculate_expected_points","text":"provided plays. Returns data probabilities scoring event EP added. following columns must present: season, home_team, posteam, roof (coded 'open', 'closed', 'retractable'), half_seconds_remaining, yardline_100, ydstogo, posteam_timeouts_remaining, defteam_timeouts_remaining","code":""},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute expected points — calculate_expected_points","text":"","code":"calculate_expected_points(pbp_data)"},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute expected points — calculate_expected_points","text":"pbp_data Play--play dataset estimate expected points .","code":""},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute expected points — calculate_expected_points","text":"original pbp_data following columns appended : ep expected points. no_score_prob probability scoring half. opp_fg_prob probability next score opponent field goal half. opp_safety_prob probability next score opponent safety half. opp_td_prob probability next score opponent touchdown half. fg_prob probability next score field goal half. safety_prob probability next score safety half. td_prob probability text score touchdown half.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute expected points — calculate_expected_points","text":"Computes expected points provided plays. Returns data probabilities scoring event EP added. following columns must present: season home_team posteam roof (coded 'outdoors', 'dome', 'open'/'closed'/NA (retractable)) half_seconds_remaining yardline_100 ydstogo posteam_timeouts_remaining defteam_timeouts_remaining","code":""},{"path":"https://www.nflfastr.com/reference/calculate_expected_points.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute expected points — calculate_expected_points","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems library(dplyr) data <- tibble::tibble( \"season\" = 1999:2019, \"home_team\" = \"SEA\", \"posteam\" = \"SEA\", \"roof\" = \"outdoors\", \"half_seconds_remaining\" = 1800, \"yardline_100\" = c(rep(80, 17), rep(75, 4)), \"down\" = 1, \"ydstogo\" = 10, \"posteam_timeouts_remaining\" = 3, \"defteam_timeouts_remaining\" = 3 ) nflfastR::calculate_expected_points(data) %>% dplyr::select(season, yardline_100, td_prob, ep) }) #> season yardline_100 td_prob ep #> 1 1999 80 0.3342112 0.6378878 #> 2 2000 80 0.3342112 0.6378878 #> 3 2001 80 0.3342112 0.6378878 #> 4 2002 80 0.3431796 0.8167660 #> 5 2003 80 0.3431796 0.8167660 #> 6 2004 80 0.3431796 0.8167660 #> 7 2005 80 0.3431796 0.8167660 #> 8 2006 80 0.3445111 0.8136176 #> 9 2007 80 0.3445111 0.8136176 #> 10 2008 80 0.3445111 0.8136176 #> 11 2009 80 0.3445111 0.8136176 #> 12 2010 80 0.3445111 0.8136176 #> 13 2011 80 0.3445111 0.8136176 #> 14 2012 80 0.3445111 0.8136176 #> 15 2013 80 0.3445111 0.8136176 #> 16 2014 80 0.3522740 0.9822985 #> 17 2015 80 0.3522740 0.9822985 #> 18 2016 75 0.3771672 1.4573911 #> 19 2017 75 0.3771672 1.4573911 #> 20 2018 75 0.4067504 1.4740978 #> 21 2019 75 0.4067504 1.4740978 # }"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Get Official Game Stats — calculate_player_stats","title":"Get Official Game Stats — calculate_player_stats","text":"Build columns aggregate official passing, rushing, receiving stats either game level level entire data frame passed.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get Official Game Stats — calculate_player_stats","text":"","code":"calculate_player_stats(pbp, weekly = FALSE)"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get Official Game Stats — calculate_player_stats","text":"pbp Data frame NFL play--play data typically loaded load_pbp() build_nflfastR_pbp(). data include variable qb_epa, function add_qb_epa() called add . weekly TRUE, returns week--week stats, otherwise, stats entire Data frame.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get Official Game Stats — calculate_player_stats","text":"data frame including following columns (ID columns decoded gsis ID format): player_id ID player. Use join sources. player_name Name player player_display_name Full name player position Position player position_group Position group player headshot_url URL player headshot image games number games player recorded passing, rushing receiving stats. recent_team recent team player appears pbp . season Season weekly TRUE week Week weekly TRUE season_type REG POST weekly TRUE opponent_team player's opponent team weekly TRUE completions number completed passes. attempts number pass attempts defined NFL. passing_yards Yards gained pass plays. passing_tds number passing touchdowns. interceptions number interceptions thrown. sacks Number times sacked. sack_yards Yards lost sack plays. sack_fumbles number sacks fumble. sack_fumbles_lost number sacks lost fumble. passing_air_yards Passing air yards (includes incomplete passes). passing_yards_after_catch Yards catch gained plays player passer (unofficial stat may differ slightly different sources). passing_first_downs First downs pass attempts. passing_epa Total expected points added pass attempts sacks. NOTE: uses variable qb_epa, gives QB credit EPA point receiver lost fumble completed catch makes EPA work like passing yards plays fumbles. passing_2pt_conversions Two-point conversion passes. pacr Passing Air Conversion Ratio. PACR = passing_yards / passing_air_yards dakota Adjusted EPA + CPOE composite based coefficients best predict adjusted EPA/play following year. carries number official rush attempts (incl. scrambles kneel downs). Rushes lateral reception count carry. rushing_yards Yards gained rushing ball (incl. scrambles kneel downs). Also includes yards gained obtaining lateral play started rushing attempt. rushing_tds number rushing touchdowns (incl. scrambles). Also includes touchdowns obtaining lateral play started rushing attempt. rushing_fumbles number rushes fumble. rushing_fumbles_lost number rushes lost fumble. rushing_first_downs First downs rush attempts (incl. scrambles). rushing_epa Expected points added rush attempts (incl. scrambles kneel downs). rushing_2pt_conversions Two-point conversion rushes receptions number pass receptions. Lateral receptions officially count reception. targets number pass plays player targeted receiver. receiving_yards Yards gained pass reception. Includes yards gained receiving lateral play started pass play. receiving_tds number touchdowns following pass reception. Also includes touchdowns receiving lateral play started pass play. receiving_air_yards Receiving air yards (incl. incomplete passes). receiving_yards_after_catch Yards catch gained plays player receiver (unofficial stat may differ slightly different sources). receiving_fumbles number fumbles pass reception. receiving_fumbles_lost number fumbles lost pass reception. receiving_2pt_conversions Two-point conversion receptions racr Receiver Air Conversion Ratio. RACR = receiving_yards / receiving_air_yards target_share share targets player targets team air_yards_share share receiving_air_yards player air_yards team wopr Weighted Opportunity Rating. WOPR = 1.5 × target_share + 0.7 × air_yards_share fantasy_points Standard fantasy points. fantasy_points_ppr PPR fantasy points.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/calculate_player_stats.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get Official Game Stats — calculate_player_stats","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems pbp <- nflfastR::load_pbp(2020) weekly <- calculate_player_stats(pbp, weekly = TRUE) dplyr::glimpse(weekly) overall <- calculate_player_stats(pbp, weekly = FALSE) dplyr::glimpse(overall) }) #> Rows: 5,447 #> Columns: 53 #> $ player_id \"00-0019596\", \"00-0019596\", \"00-0019596\", … #> $ player_name \"T.Brady\", \"T.Brady\", \"T.Brady\", \"T.Brady\"… #> $ player_display_name \"Tom Brady\", \"Tom Brady\", \"Tom Brady\", \"To… #> $ position \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", … #> $ position_group \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", \"QB\", … #> $ headshot_url \"https://static.www.nfl.com/image/private/… #> $ recent_team \"TB\", \"TB\", \"TB\", \"TB\", \"TB\", \"TB\", \"TB\", … #> $ season 2020, 2020, 2020, 2020, 2020, 2020, 2020, … #> $ week 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14,… #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", … #> $ opponent_team \"NO\", \"CAR\", \"DEN\", \"LAC\", \"CHI\", \"GB\", \"L… #> $ completions 23, 23, 25, 30, 25, 17, 33, 28, 22, 28, 26… #> $ attempts 36, 35, 38, 46, 41, 27, 45, 40, 38, 39, 48… #> $ passing_yards 239, 217, 297, 369, 253, 166, 369, 279, 20… #> $ passing_tds 2, 1, 3, 5, 1, 2, 4, 2, 0, 3, 2, 3, 2, 2, … #> $ interceptions 2, 1, 0, 1, 0, 0, 0, 0, 3, 0, 2, 2, 0, 0, … #> $ sacks 3, 0, 2, 0, 3, 0, 0, 2, 3, 1, 1, 1, 0, 3, … #> $ sack_yards 15, 0, 12, 0, 20, 0, 0, 16, 23, 7, 7, 3, 0… #> $ sack_fumbles 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ sack_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ passing_air_yards 292, 234, 311, 431, 383, 231, 399, 364, 36… #> $ passing_yards_after_catch 90, 110, 111, 109, 100, 72, 134, 94, 80, 1… #> $ passing_first_downs 10, 11, 12, 20, 11, 9, 22, 18, 10, 18, 14,… #> $ passing_epa -9.4968573, 0.5243797, 11.5597024, 12.6856… #> $ passing_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ pacr 0.8184932, 0.9273504, 0.9549839, 0.8561485… #> $ dakota 0.06893691, 0.07635570, 0.15510344, 0.2138… #> $ carries 3, 1, 5, 3, 3, 0, 1, 1, 0, 2, 0, 1, 3, 2, … #> $ rushing_yards 9, 0, 0, -3, 0, 0, 1, -1, 0, 2, 0, -1, -2,… #> $ rushing_tds 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, … #> $ rushing_fumbles 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ rushing_fumbles_lost 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ rushing_first_downs 2, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, … #> $ rushing_epa 1.5054478, -5.4885905, -3.8117261, -1.1660… #> $ rushing_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receptions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ targets 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_air_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_yards_after_catch 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_first_downs 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_epa NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ receiving_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ racr NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ target_share NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ air_yards_share NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ wopr NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ special_teams_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ fantasy_points 20.46, 8.68, 23.88, 32.46, 14.12, 14.64, 3… #> $ fantasy_points_ppr 20.46, 8.68, 23.88, 32.46, 14.12, 14.64, 3… #> Rows: 636 #> Columns: 50 #> $ player_id \"00-0019596\", \"00-0020531\", \"00-0022127\", … #> $ player_name \"T.Brady\", \"D.Brees\", \"J.Witten\", \"M.Schau… #> $ player_display_name \"Tom Brady\", \"Drew Brees\", \"Jason Witten\",… #> $ position \"QB\", \"QB\", \"TE\", \"QB\", \"P\", \"WR\", \"QB\", \"… #> $ position_group \"QB\", \"QB\", \"TE\", \"QB\", \"SPEC\", \"WR\", \"QB\"… #> $ headshot_url \"https://static.www.nfl.com/image/private/… #> $ games 20, 14, 10, 1, 1, 13, 16, 17, 8, 18, 15, 9… #> $ recent_team \"TB\", \"NO\", \"LV\", \"ATL\", \"ARI\", \"ARI\", \"PI… #> $ completions 482, 322, 0, 0, 1, 0, 446, 396, 168, 428, … #> $ attempts 748, 463, 0, 0, 1, 0, 676, 589, 252, 610, … #> $ passing_yards 5694, 3341, 0, 0, 26, 0, 4304, 4478, 1582,… #> $ passing_tds 50, 27, 0, 0, 0, 0, 37, 26, 6, 53, 0, 13, … #> $ interceptions 15, 9, 0, 0, 0, 0, 14, 11, 8, 6, 0, 8, 0, … #> $ sacks 27, 13, 0, 0, 0, 0, 13, 19, 22, 25, 0, 14,… #> $ sack_yards 180, 89, 0, 0, 0, 0, 118, 118, 139, 214, 0… #> $ sack_fumbles 2, 6, 0, 0, 0, 0, 2, 2, 1, 1, 0, 2, 0, 0, … #> $ sack_fumbles_lost 0, 2, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, … #> $ passing_air_yards 6900, 2723, 0, 0, 14, 0, 4785, 4235, 1286,… #> $ passing_yards_after_catch 2256, 1700, 0, 0, 12, 0, 2136, 2346, 949, … #> $ passing_first_downs 288, 169, 0, 0, 1, 0, 222, 217, 74, 250, 0… #> $ passing_epa 174.550932, 64.772986, NA, NA, 4.014011, N… #> $ passing_2pt_conversions 0, 0, 0, 0, 0, 0, 3, 2, 0, 0, 0, 2, 0, 0, … #> $ pacr 0.8252174, 1.2269556, NA, NA, 1.8571429, N… #> $ dakota 0.16324949, 0.11352942, NA, NA, NA, NA, 0.… #> $ carries 43, 23, 0, 3, 0, 0, 26, 19, 10, 42, 187, 3… #> $ rushing_yards 3, 3, 0, -4, 0, 0, 11, -9, 3, 146, 653, 15… #> $ rushing_tds 4, 2, 0, 0, 0, 0, 0, 0, 0, 4, 2, 2, 0, 0, … #> $ rushing_fumbles 4, 1, 0, 0, 0, 0, 3, 0, 1, 3, 1, 0, 0, 0, … #> $ rushing_fumbles_lost 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, … #> $ rushing_first_downs 8, 7, 0, 0, 0, 0, 3, 0, 0, 16, 32, 12, 0, … #> $ rushing_epa -22.6205957, -8.2220291, NA, 0.0000000, NA… #> $ rushing_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, … #> $ receptions 0, 0, 13, 0, 0, 54, 0, 0, 0, 1, 16, 1, 13,… #> $ targets 0, 0, 17, 0, 0, 72, 0, 0, 0, 1, 19, 1, 20,… #> $ receiving_yards 0, 0, 69, 0, 0, 409, 0, 0, 0, -6, 89, 0, 1… #> $ receiving_tds 0, 0, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 3, 0, … #> $ receiving_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_air_yards 0, 0, 91, 0, 0, 432, 0, 0, 0, -4, 34, -4, … #> $ receiving_yards_after_catch 0, 0, 20, 0, 0, 185, 0, 0, 0, -2, 73, 4, 7… #> $ receiving_first_downs 0, 0, 8, 0, 0, 25, 0, 0, 0, 0, 3, 0, 7, 0,… #> $ receiving_epa NA, NA, 2.4071780, NA, NA, -1.7713509, NA,… #> $ receiving_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ racr NA, NA, 0.7582418, NA, NA, 0.9467593, NA, … #> $ target_share NA, NA, 0.05279503, NA, NA, 0.16071429, NA… #> $ air_yards_share NA, NA, 0.033641405, NA, NA, 0.117615029, … #> $ wopr NA, NA, 0.10274153, NA, NA, 0.32340195, NA… #> $ special_teams_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ fantasy_points 420.06, 231.94, 18.90, -0.40, 1.04, 46.90,… #> $ fantasy_points_ppr 420.06, 231.94, 31.90, -0.40, 1.04, 100.90… # }"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_def.html","id":null,"dir":"Reference","previous_headings":"","what":"Get Official Game Stats on Defense — calculate_player_stats_def","title":"Get Official Game Stats on Defense — calculate_player_stats_def","text":"Build columns aggregate official defense stats either game level level entire data frame passed.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_def.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get Official Game Stats on Defense — calculate_player_stats_def","text":"","code":"calculate_player_stats_def(pbp, weekly = FALSE)"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_def.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get Official Game Stats on Defense — calculate_player_stats_def","text":"pbp Data frame NFL play--play data typically loaded load_pbp() build_nflfastR_pbp(). data include variable qb_epa, function add_qb_epa() called add . weekly TRUE, returns week--week stats, otherwise, stats entire Data frame.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_def.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get Official Game Stats on Defense — calculate_player_stats_def","text":"data frame defensive player stats. See dictionary (# TODO)","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_def.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get Official Game Stats on Defense — calculate_player_stats_def","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems pbp <- nflfastR::load_pbp(2020) weekly <- calculate_player_stats_def(pbp, weekly = TRUE) dplyr::glimpse(weekly) overall <- calculate_player_stats_def(pbp, weekly = FALSE) dplyr::glimpse(overall) }) #> Rows: 9,275 #> Columns: 32 #> $ season 2020, 2020, 2020, 2020, 2020, 2020, 2020… #> $ week 3, 11, 3, 5, 11, 12, 15, 6, 10, 12, 15, … #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\"… #> $ player_id \"00-0022921\", \"00-0022924\", \"00-0023448\"… #> $ player_name \"L.Fitzgerald\", \"B.Roethlisberger\", \"T.D… #> $ player_display_name \"Larry Fitzgerald\", \"Ben Roethlisberger\"… #> $ position \"WR\", \"QB\", \"OLB\", \"OLB\", \"OLB\", \"OLB\", … #> $ position_group \"WR\", \"QB\", \"LB\", \"LB\", \"LB\", \"LB\", \"LB\"… #> $ headshot_url \"https://static.www.nfl.com/image/privat… #> $ team \"DET\", \"JAX\", \"WAS\", \"WAS\", \"WAS\", \"WAS\"… #> $ def_tackles 1, 1, 2, 0, 1, 2, 0, 1, 1, 3, 3, 3, 2, 2… #> $ def_tackles_solo 1, 1, 2, 0, 1, 2, 0, 1, 1, 3, 3, 3, 2, 2… #> $ def_tackles_with_assist 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_tackle_assists 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0… #> $ def_tackles_for_loss 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_tackles_for_loss_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumbles_forced 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_sacks 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_sack_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_qb_hits 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0… #> $ def_interceptions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_interception_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_pass_defended 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0… #> $ def_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_own 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_yards_own 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_opp 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_yards_opp 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_safety 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_penalty 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_penalty_yards 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> Rows: 1,418 #> Columns: 30 #> $ player_id \"00-0022921\", \"00-0022924\", \"00-0023448\"… #> $ player_name \"L.Fitzgerald\", \"B.Roethlisberger\", \"T.D… #> $ player_display_name \"Larry Fitzgerald\", \"Ben Roethlisberger\"… #> $ games 1, 1, 5, 1, 5, 3, 7, 6, 1, 1, 13, 1, 5, … #> $ position \"WR\", \"QB\", \"OLB\", \"QB\", \"CB\", \"CB\", \"CB… #> $ position_group \"WR\", \"QB\", \"LB\", \"QB\", \"DB\", \"DB\", \"DB\"… #> $ headshot_url \"https://static.www.nfl.com/image/privat… #> $ team \"DET\", \"JAX\", \"WAS\", \"NYJ\", \"BAL\", \"ARI\"… #> $ def_tackles 1, 1, 5, 1, 12, 3, 25, 6, 1, 1, 19, 1, 8… #> $ def_tackles_solo 1, 1, 5, 1, 12, 2, 23, 6, 1, 1, 16, 1, 6… #> $ def_tackles_with_assist 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 3, 0, 2, 2… #> $ def_tackle_assists 0, 0, 1, 0, 4, 0, 4, 10, 0, 0, 13, 0, 6,… #> $ def_tackles_for_loss 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 2… #> $ def_tackles_for_loss_yards 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 4… #> $ def_fumbles_forced 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0… #> $ def_sacks 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, … #> $ def_sack_yards 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, … #> $ def_qb_hits 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 11, 0, 0, … #> $ def_interceptions 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0… #> $ def_interception_yards 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0… #> $ def_pass_defended 0, 0, 1, 0, 1, 1, 5, 0, 0, 0, 7, 0, 0, 0… #> $ def_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_own 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_yards_own 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_opp 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_fumble_recovery_yards_opp 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_safety 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ def_penalty 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 3, 1, 1, 1… #> $ def_penalty_yards 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, 25, 14, 1… # }"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_kicking.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize Kicking Stats — calculate_player_stats_kicking","title":"Summarize Kicking Stats — calculate_player_stats_kicking","text":"Build columns aggregate kicking stats game level.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_kicking.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize Kicking Stats — calculate_player_stats_kicking","text":"","code":"calculate_player_stats_kicking(pbp, weekly = FALSE)"},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_kicking.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize Kicking Stats — calculate_player_stats_kicking","text":"pbp Data frame NFL play--play data typically loaded load_pbp() build_nflfastR_pbp(). weekly TRUE, returns week--week stats, otherwise, stats entire data frame argument pbp.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_kicking.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summarize Kicking Stats — calculate_player_stats_kicking","text":"dataframe kicking stats","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/calculate_player_stats_kicking.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize Kicking Stats — calculate_player_stats_kicking","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems pbp <- nflreadr::load_pbp(2021) weekly <- calculate_player_stats_kicking(pbp, weekly = TRUE) dplyr::glimpse(weekly) overall <- calculate_player_stats_kicking(pbp, weekly = FALSE) dplyr::glimpse(overall) }) #> Rows: 561 #> Columns: 44 #> $ season 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 20… #> $ week 1, 2, 3, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19… #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"… #> $ player_id \"00-0023252\", \"00-0023252\", \"00-0023252\", \"00-0023… #> $ team \"SF\", \"SF\", \"SF\", \"SF\", \"SF\", \"SF\", \"SF\", \"SF\", \"S… #> $ player_name \"R.Gould\", \"R.Gould\", \"R.Gould\", \"R.Gould\", \"R.Gou… #> $ player_display_name \"Robbie Gould\", \"Robbie Gould\", \"Robbie Gould\", \"R… #> $ position \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", … #> $ position_group \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"S… #> $ headshot_url \"https://static.www.nfl.com/image/private/f_auto,q… #> $ fg_made 2, 1, NA, 1, 1, 3, 2, 1, 2, 1, 1, 3, 2, 3, 2, 1, 1… #> $ fg_att 3, 1, 0, 1, 1, 3, 3, 1, 3, 1, 1, 3, 2, 3, 2, 1, 2,… #> $ fg_missed 1, 0, NA, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1… #> $ fg_blocked 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_long 52, 46, NA, 26, 50, 48, 46, 50, 33, 30, 48, 37, 42… #> $ fg_pct 0.667, 1.000, NA, 1.000, 1.000, 1.000, 0.667, 1.00… #> $ fg_made_0_19 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_made_20_29 0, 0, NA, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0… #> $ fg_made_30_39 0, 0, NA, 0, 0, 0, 0, 0, 1, 1, 0, 2, 0, 0, 0, 1, 1… #> $ fg_made_40_49 1, 1, NA, 0, 0, 2, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0… #> $ fg_made_50_59 1, 0, NA, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0… #> $ fg_made_60_ 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_missed_0_19 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_missed_20_29 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_missed_30_39 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_missed_40_49 0, 0, NA, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1… #> $ fg_missed_50_59 1, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_missed_60_ 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ fg_made_list \"40;52\", \"46\", NA, \"26\", \"50\", \"20;48;45\", \"46;22\"… #> $ fg_missed_list \"52\", NA, NA, NA, NA, NA, \"42\", NA, \"47\", NA, NA, … #> $ fg_blocked_list NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA… #> $ fg_made_distance 92, 46, NA, 26, 50, 113, 68, 50, 57, 30, 48, 100, … #> $ fg_missed_distance 52, 0, NA, 0, 0, 0, 42, 0, 47, 0, 0, 0, 0, 0, 0, 0… #> $ fg_blocked_distance 0, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ pat_made 5, 2, 4, 2, 4, 3, 4, 2, 2, 4, 2, 2, 3, 2, 1, 2, 5,… #> $ pat_att 5, 2, 4, 2, 4, 3, 4, 3, 2, 4, 2, 2, 3, 2, 1, 2, 5,… #> $ pat_missed 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ pat_blocked 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ pat_pct 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 0… #> $ gwfg_att 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0,… #> $ gwfg_distance NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 24… #> $ gwfg_made NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 1,… #> $ gwfg_missed NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0,… #> $ gwfg_blocked NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0,… #> Rows: 58 #> Columns: 42 #> $ player_id \"00-0023252\", \"00-0023853\", \"00-0025565\", \"00-0025… #> $ team \"SF\", \"ARI\", \"NE\", \"GB\", \"NYG\", \"TB\", \"TEN\", \"BAL\"… #> $ player_name \"R.Gould\", \"M.Prater\", \"N.Folk\", \"M.Crosby\", \"G.Ga… #> $ player_display_name \"Robbie Gould\", \"Matt Prater\", \"Nick Folk\", \"Mason… #> $ games 16, 18, 18, 18, 17, 19, 17, 17, 16, 17, 11, 6, 7, … #> $ position \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", \"K\", … #> $ position_group \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"SPEC\", \"S… #> $ headshot_url \"https://static.www.nfl.com/image/private/f_auto,q… #> $ fg_made 26, 31, 37, 26, 29, 28, 27, 35, 30, 26, 18, 12, 16… #> $ fg_att 29, 38, 40, 36, 33, 34, 32, 37, 36, 31, 20, 14, 18… #> $ fg_missed 3, 7, 3, 7, 4, 6, 5, 2, 6, 4, 2, 2, 2, NA, 4, 3, 6… #> $ fg_blocked 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, NA, 0, 1, 0… #> $ fg_long 53, 62, 53, 54, 55, 48, 51, 66, 56, 61, 50, 50, 42… #> $ fg_pct 0.897, 0.816, 0.925, 0.722, 0.879, 0.824, 0.844, 0… #> $ fg_made_0_19 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, NA, 0, 0, 0… #> $ fg_made_20_29 7, 11, 9, 9, 5, 11, 5, 7, 5, 7, 5, 3, 4, NA, 9, 10… #> $ fg_made_30_39 5, 9, 11, 10, 12, 9, 13, 9, 15, 6, 4, 2, 8, NA, 8,… #> $ fg_made_40_49 9, 3, 12, 4, 5, 8, 8, 13, 7, 8, 7, 6, 4, NA, 11, 1… #> $ fg_made_50_59 5, 7, 5, 3, 7, 0, 1, 5, 3, 4, 1, 1, 0, NA, 8, 0, 3… #> $ fg_made_60_ 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, NA, 0, 0, 0… #> $ fg_missed_0_19 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0… #> $ fg_missed_20_29 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0… #> $ fg_missed_30_39 0, 2, 0, 2, 1, 1, 0, 0, 1, 0, 0, 0, 1, NA, 1, 0, 2… #> $ fg_missed_40_49 2, 2, 0, 4, 0, 4, 5, 2, 2, 0, 0, 1, 0, NA, 2, 1, 2… #> $ fg_missed_50_59 1, 1, 3, 1, 3, 1, 0, 0, 2, 4, 2, 1, 1, NA, 1, 1, 2… #> $ fg_missed_60_ 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, NA, 0, 1, 0… #> $ fg_made_list \"40;52;46;26;50;20;48;45;46;22;50;33;24;30;48;37;2… #> $ fg_missed_list \"52;42;47\", \"43;68;61;39;36;51;41\", \"56;54;53\", \"3… #> $ fg_blocked_list NA, NA, NA, \"34;37;39\", NA, NA, NA, NA, NA, \"22\", … #> $ fg_made_distance 1003, 1158, 1399, 936, 1146, 931, 985, 1401, 1139,… #> $ fg_missed_distance 141, 339, 163, 283, 196, 273, 226, 97, 287, 212, 1… #> $ fg_blocked_distance 0, 0, 0, 110, 0, 0, 0, 0, 0, 22, 0, 0, 0, NA, 0, 4… #> $ pat_made 44, 47, 44, 50, 17, 63, 43, 32, 44, 33, 30, 10, 10… #> $ pat_att 45, 49, 49, 52, 17, 66, 46, 32, 50, 34, 32, 12, 12… #> $ pat_missed 1, 2, 4, 2, 0, 3, 3, 0, 6, 1, 2, 2, 2, 2, 2, 1, 3,… #> $ pat_blocked 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ pat_pct 0.978, 0.959, 0.898, 0.962, 1.000, 0.955, 0.935, 1… #> $ gwfg_att 2, 1, 2, 2, 2, 2, 3, 3, 1, 0, 1, 1, 0, 0, 3, 2, 0,… #> $ gwfg_distance_list \"24;45\", \"27\", \"56;21\", \"51;49\", \"35;27\", \"36;48\",… #> $ gwfg_made 2, 1, 1, 2, 2, 2, 3, 3, 1, NA, 1, 1, NA, NA, 3, 1,… #> $ gwfg_missed 0, 0, 1, 0, 0, 0, 0, 0, 0, NA, 0, 0, NA, NA, 0, 1,… #> $ gwfg_blocked 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, 0, 0, NA, NA, 0, 0,… # }"},{"path":"https://www.nflfastr.com/reference/calculate_series_conversion_rates.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","title":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","text":"\"Series\" begins 1st 10 team attempts either earn new 1st (offense) prevent offense converting new 1st (defense). Series conversion rate represents many series either converted new 1st ended touchdown. function computes series conversion rates offense defense nflverse play--play data along series results. function automatically removes series ended QB kneel .","code":""},{"path":"https://www.nflfastr.com/reference/calculate_series_conversion_rates.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","text":"","code":"calculate_series_conversion_rates(pbp, weekly = FALSE)"},{"path":"https://www.nflfastr.com/reference/calculate_series_conversion_rates.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","text":"pbp Play--play data returned load_pbp(), build_nflfastR_pbp(), fast_scraper(). weekly TRUE, returns week--week stats, otherwise, season--season stats argument pbp.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_series_conversion_rates.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","text":"data frame series information including following columns: season NFL season team NFL team abbreviation week Week weekly TRUE off_n number series offense played (excludes QB kneel downs, kickoffs, extra point/two point conversion attempts, non-plays, plays list \"posteam\") off_scr rate series ended either new 1st touchdown offense field off_scr_1st rate offense earned 1st scored touchdown 1st off_scr_2nd rate offense earned 1st scored touchdown 2nd off_scr_3rd rate offense earned 1st scored touchdown 3rd off_scr_4th rate offense earned 1st scored touchdown 4th off_1st rate series ended new 1st offense field (include offensive touchdown) off_td rate series ended offensive touchdown offense field off_fg rate series ended field goal attempt offense field off_punt rate series ended punt offense field off_to rate series ended turnover (including downs), opponent score, end half (game) offense field def_n number series defense played (excludes QB kneel downs, kickoffs, extra point/two point conversion attempts, non-plays, plays list \"posteam\") def_scr rate series ended either new 1st touchdown defense field def_scr_1st rate defense allowed 1st touchdown 1st def_scr_2nd rate defense allowed 1st touchdown 2nd def_scr_3rd rate defense allowed 1st touchdown 3rd def_scr_4th rate defense allowed 1st touchdown 4th def_1st rate series ended new 1st defense field (include offensive touchdown) def_td rate series ended offensive touchdown defense field def_fg rate series ended field goal attempt defense field def_punt rate series ended punt defense field def_to rate series ended turnover (including downs), opponent score, end half (game) defense field","code":""},{"path":"https://www.nflfastr.com/reference/calculate_series_conversion_rates.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute Series Conversion Information from Play by Play — calculate_series_conversion_rates","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems pbp <- nflfastR::load_pbp(2021) weekly <- calculate_series_conversion_rates(pbp, weekly = TRUE) dplyr::glimpse(weekly) overall <- calculate_series_conversion_rates(pbp, weekly = FALSE) dplyr::glimpse(overall) }) #> Rows: 570 #> Columns: 25 #> $ season 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021… #> $ team \"ARI\", \"ARI\", \"ARI\", \"ARI\", \"ARI\", \"ARI\", \"ARI\", \"ARI\", \"A… #> $ week 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18,… #> $ off_n 28, 29, 31, 32, 27, 29, 31, 27, 28, 21, 36, 20, 31, 31, 27… #> $ off_scr 0.7857143, 0.7241379, 0.7419355, 0.8437500, 0.7407407, 0.8… #> $ off_scr_1st 0.1428571, 0.2413793, 0.1935484, 0.1250000, 0.1851852, 0.1… #> $ off_scr_2nd 0.3571429, 0.3448276, 0.4516129, 0.4375000, 0.4444444, 0.3… #> $ off_scr_3rd 0.28571429, 0.10344828, 0.03225806, 0.28125000, 0.11111111… #> $ off_scr_4th 0.00000000, 0.03448276, 0.06451613, 0.00000000, 0.00000000… #> $ off_1st 0.6071429, 0.5862069, 0.6451613, 0.7187500, 0.6666667, 0.6… #> $ off_td 0.17857143, 0.13793103, 0.09677419, 0.12500000, 0.07407407… #> $ off_fg 0.07142857, 0.06896552, 0.03225806, 0.09375000, 0.07407407… #> $ off_punt 0.10714286, 0.13793103, 0.16129032, 0.06250000, 0.14814815… #> $ off_to 0.03571429, 0.06896552, 0.06451613, 0.00000000, 0.03703704… #> $ def_n 26, 30, 30, 31, 25, 23, 19, 30, 30, 33, 24, 32, 24, 27, 27… #> $ def_scr 0.6538462, 0.7333333, 0.6666667, 0.7741935, 0.6800000, 0.6… #> $ def_scr_1st 0.1923077, 0.2666667, 0.2000000, 0.2580645, 0.2400000, 0.2… #> $ def_scr_2nd 0.2307692, 0.3666667, 0.3666667, 0.3225806, 0.2800000, 0.2… #> $ def_scr_3rd 0.19230769, 0.06666667, 0.06666667, 0.19354839, 0.12000000… #> $ def_scr_4th 0.03846154, 0.03333333, 0.03333333, 0.00000000, 0.04000000… #> $ def_1st 0.5769231, 0.6333333, 0.6000000, 0.7096774, 0.6400000, 0.5… #> $ def_td 0.07692308, 0.10000000, 0.06666667, 0.06451613, 0.04000000… #> $ def_fg 0.03846154, 0.10000000, 0.00000000, 0.09677419, 0.04000000… #> $ def_punt 0.11538462, 0.16666667, 0.20000000, 0.03225806, 0.08000000… #> $ def_to 0.19230769, 0.00000000, 0.13333333, 0.09677419, 0.20000000… #> Rows: 32 #> Columns: 24 #> $ season 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021, 2021… #> $ team \"ARI\", \"ATL\", \"BAL\", \"BUF\", \"CAR\", \"CHI\", \"CIN\", \"CLE\", \"D… #> $ off_n 510, 439, 538, 568, 474, 471, 568, 463, 540, 449, 463, 504… #> $ off_scr 0.7431373, 0.6856492, 0.7267658, 0.7834507, 0.6666667, 0.7… #> $ off_scr_1st 0.1843137, 0.2050114, 0.2416357, 0.2605634, 0.2025316, 0.2… #> $ off_scr_2nd 0.3039216, 0.2391800, 0.2918216, 0.2799296, 0.2468354, 0.2… #> $ off_scr_3rd 0.2176471, 0.2118451, 0.1561338, 0.2147887, 0.1856540, 0.1… #> $ off_scr_4th 0.03725490, 0.02961276, 0.03717472, 0.02816901, 0.03164557… #> $ off_1st 0.6431373, 0.6150342, 0.6524164, 0.6637324, 0.6012658, 0.6… #> $ off_td 0.10000000, 0.07061503, 0.07434944, 0.11971831, 0.06540084… #> $ off_fg 0.07254902, 0.06150342, 0.06877323, 0.05633803, 0.06118143… #> $ off_punt 0.11176471, 0.14578588, 0.13197026, 0.09859155, 0.15611814… #> $ off_to 0.07254902, 0.10706150, 0.07249071, 0.06161972, 0.11603376… #> $ def_n 483, 490, 476, 488, 451, 439, 592, 451, 509, 434, 484, 477… #> $ def_scr 0.7142857, 0.7734694, 0.7142857, 0.6762295, 0.6851441, 0.7… #> $ def_scr_1st 0.2380952, 0.2183673, 0.2647059, 0.1885246, 0.2283814, 0.2… #> $ def_scr_2nd 0.2525880, 0.2979592, 0.2605042, 0.2438525, 0.2372506, 0.2… #> $ def_scr_3rd 0.1904762, 0.2306122, 0.1638655, 0.1967213, 0.1929047, 0.2… #> $ def_scr_4th 0.03312629, 0.02653061, 0.02521008, 0.04713115, 0.02660754… #> $ def_1st 0.6252588, 0.6714286, 0.6218487, 0.5983607, 0.5920177, 0.6… #> $ def_td 0.08902692, 0.10204082, 0.09243697, 0.07786885, 0.09312639… #> $ def_fg 0.06211180, 0.05714286, 0.05672269, 0.05737705, 0.08203991… #> $ def_punt 0.13043478, 0.10816327, 0.17436975, 0.16188525, 0.16407982… #> $ def_to 0.09316770, 0.06122449, 0.05462185, 0.10450820, 0.06873614… # }"},{"path":"https://www.nflfastr.com/reference/calculate_standings.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","title":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","text":"function calculates division standings well playoff seeds per conference based either nflverse play--play data nflverse schedule data.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_standings.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","text":"","code":"calculate_standings( nflverse_object, tiebreaker_depth = 3, playoff_seeds = NULL )"},{"path":"https://www.nflfastr.com/reference/calculate_standings.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","text":"nflverse_object Data object class nflverse_data. Either schedules returned fast_scraper_schedules() nflreadr::load_schedules(). play--play data returned load_pbp(), build_nflfastR_pbp(), fast_scraper(). tiebreaker_depth single value equal 1, 2, 3. default 3. value controls depth tiebreakers shall applied. deepest currently implemented tiebreaker strength schedule. following values valid: tiebreaker_depth = 1 Break ties coinflip. Fastest variant. tiebreaker_depth = 2 Apply head--head division win percentage tiebreakers. Random still tied. tiebreaker_depth = 3 Apply tiebreakers strength schedule. Random still tied. playoff_seeds Number playoff teams per conference. NULL (default), function try split nflverse_object seasons prior 2020 (6 seeds) 2020ff (7 seeds). set numeric, used seasons nflverse_object!","code":""},{"path":"https://www.nflfastr.com/reference/calculate_standings.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","text":"tibble NFL regular season standings","code":""},{"path":"https://www.nflfastr.com/reference/calculate_standings.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute Division Standings and Conference Seeds from Play by Play — calculate_standings","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems # load nflverse data both schedules and pbp scheds <- fast_scraper_schedules(2014) pbp <- load_pbp(c(2018, 2021)) # calculate standings based on pbp calculate_standings(pbp) # calculate standings based on schedules calculate_standings(scheds) }) #> # A tibble: 32 × 15 #> season conf division div_rank seed team games wins losses ties win_pct #> #> 1 2014 AFC AFC East 1 1 NE 16 12 4 0 0.75 #> 2 2014 AFC AFC East 2 NA BUF 16 9 7 0 0.562 #> 3 2014 AFC AFC East 3 NA MIA 16 8 8 0 0.5 #> 4 2014 AFC AFC East 4 NA NYJ 16 4 12 0 0.25 #> 5 2014 AFC AFC North 1 3 PIT 16 11 5 0 0.688 #> 6 2014 AFC AFC North 2 5 CIN 16 10 5 1 0.656 #> 7 2014 AFC AFC North 3 6 BAL 16 10 6 0 0.625 #> 8 2014 AFC AFC North 4 NA CLE 16 7 9 0 0.438 #> 9 2014 AFC AFC South 1 4 IND 16 11 5 0 0.688 #> 10 2014 AFC AFC South 2 NA HOU 16 9 7 0 0.562 #> # ℹ 22 more rows #> # ℹ 4 more variables: div_pct , conf_pct , sov , sos # }"},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute win probability — calculate_win_probability","title":"Compute win probability — calculate_win_probability","text":"provided plays. Returns data probabilities winning game. following columns must present: receive_h2_ko (1 game 1st half possession team receive 2nd half kickoff, 0 otherwise), home_team, posteam, half_seconds_remaining, game_seconds_remaining, spread_line (many points home team favored ), , ydstogo, yardline_100, posteam_timeouts_remaining, defteam_timeouts_remaining","code":""},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute win probability — calculate_win_probability","text":"","code":"calculate_win_probability(pbp_data)"},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute win probability — calculate_win_probability","text":"pbp_data Play--play dataset estimate win probability .","code":""},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute win probability — calculate_win_probability","text":"original pbp_data following columns appended : wp win probability. vegas_wp win probability taking account pre-game spread.","code":""},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute win probability — calculate_win_probability","text":"Computes win probability provided plays. Returns data spread non-spread-adjusted win probabilities. following columns must present: receive_2h_ko (1 game 1st half possession team receive 2nd half kickoff, 0 otherwise) score_differential home_team posteam half_seconds_remaining game_seconds_remaining spread_line (many points home team favored ) ydstogo yardline_100 posteam_timeouts_remaining defteam_timeouts_remaining","code":""},{"path":"https://www.nflfastr.com/reference/calculate_win_probability.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute win probability — calculate_win_probability","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems library(dplyr) data <- tibble::tibble( \"receive_2h_ko\" = 0, \"home_team\" = \"SEA\", \"posteam\" = \"SEA\", \"score_differential\" = 0, \"half_seconds_remaining\" = 1800, \"game_seconds_remaining\" = 3600, \"spread_line\" = c(1, 3, 4, 7, 14), \"down\" = 1, \"ydstogo\" = 10, \"yardline_100\" = 75, \"posteam_timeouts_remaining\" = 3, \"defteam_timeouts_remaining\" = 3 ) nflfastR::calculate_win_probability(data) %>% dplyr::select(spread_line, wp, vegas_wp) }) #> # A tibble: 5 × 3 #> spread_line wp vegas_wp #> #> 1 1 0.546 0.515 #> 2 3 0.546 0.596 #> 3 4 0.546 0.638 #> 4 7 0.546 0.737 #> 5 14 0.546 0.866 # }"},{"path":"https://www.nflfastr.com/reference/clean_pbp.html","id":null,"dir":"Reference","previous_headings":"","what":"Clean Play by Play Data — clean_pbp","title":"Clean Play by Play Data — clean_pbp","text":"Clean Play Play Data","code":""},{"path":"https://www.nflfastr.com/reference/clean_pbp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Clean Play by Play Data — clean_pbp","text":"","code":"clean_pbp(pbp, ...)"},{"path":"https://www.nflfastr.com/reference/clean_pbp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Clean Play by Play Data — clean_pbp","text":"pbp Data frame play--play data scraped using fast_scraper(). ... Additional arguments passed message function (internal use).","code":""},{"path":"https://www.nflfastr.com/reference/clean_pbp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Clean Play by Play Data — clean_pbp","text":"input Data Frame parameter 'pbp' following columns added: success Binary indicator wheter epa > 0 given play. passer Name dropback player (scrambles included) including plays penalties. passer_jersey_number Jersey number passer. rusher Name rusher (scrambles) including plays penalties. rusher_jersey_number Jersey number rusher. receiver Name receiver including plays penalties. receiver_jersey_number Jersey number receiver. pass Binary indicator play pass play (sacks scrambles included). rush Binary indicator play rushing play. special Binary indicator play special teams play. first_down Binary indicator play ended first . aborted_play Binary indicator play description indicates \"Aborted\". play Binary indicator: 1 play 'normal' play (including penalties), 0 otherwise. passer_id ID player 'passer' column. rusher_id ID player 'rusher' column. receiver_id ID player 'receiver' column. name Name 'passer' 'NA', name 'rusher' otherwise. fantasy Name rusher rush plays receiver pass plays. fantasy_id ID rusher rush plays receiver pass plays. fantasy_player_name Name rusher rush plays receiver pass plays (official stats). fantasy_player_id ID rusher rush plays receiver pass plays (official stats). jersey_number Jersey number player listed 'name' column. id ID player 'name' column. out_of_bounds = 1 play description contains \"ran ob\", \"pushed ob\", \"sacked ob\"; = 0 otherwise. home_opening_kickoff = 1 home team received opening kickoff, 0 otherwise.","code":""},{"path":"https://www.nflfastr.com/reference/clean_pbp.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Clean Play by Play Data — clean_pbp","text":"Build columns capture happens plays, including penalties, using string extraction play description. Loosely based Ben's nflfastR guide (https://www.nflfastr.com/articles/beginners_guide.html) updated work RS data, different player format play description; e.g. 24-M.Lynch instead M.Lynch. function also standardizes team abbreviations , example, Chargers always represented 'LAC' regardless year . Starting 2022, play--play data missing gsis player IDs rookies. functions tries fix many possible.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/decode_player_ids.html","id":null,"dir":"Reference","previous_headings":"","what":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","title":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","text":"Takes columns ending 'player_id' well variables 'passer_id', 'rusher_id', 'fantasy_id', 'receiver_id', 'id' nflfastR play--play data set decodes player IDs commonly known GSIS ID format 00-00xxxxx. function uses default high efficient decode_ids package gsisdecoder. unlikely event problem function, nflfastR internal decoder can used option fast = FALSE. 2022 play play data introduced new player IDs decoded gsisdecoder. case, IDs joined nflreadr::load_players.","code":""},{"path":"https://www.nflfastr.com/reference/decode_player_ids.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","text":"","code":"decode_player_ids(pbp, ..., fast = TRUE)"},{"path":"https://www.nflfastr.com/reference/decode_player_ids.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","text":"pbp Data frame play--play data scraped using fast_scraper(). ... Additional arguments passed message function (internal use). fast TRUE IDs decoded high efficient function decode_ids. FALSE nflfastR internal function used decoding (generally recommended , unless problem decode_ids can take several days fix CRAN.)","code":""},{"path":"https://www.nflfastr.com/reference/decode_player_ids.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","text":"input data frame parameter pbp decoded player IDs.","code":""},{"path":"https://www.nflfastr.com/reference/decode_player_ids.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Decode the player IDs in nflfastR play-by-play data — decode_player_ids","text":"","code":"# \\donttest{ # Decode data frame consisting of some names and ids decode_player_ids(data.frame( name = c(\"P.Mahomes\", \"B.Baldwin\", \"P.Mahomes\", \"S.Carl\", \"J.Jones\"), id = c( \"32013030-2d30-3033-3338-3733fa30c4fa\", NA_character_, \"00-0033873\", NA_character_, \"32013030-2d30-3032-3739-3434d4d3846d\" ) )) #> • 11:07:38 | Decode player ids... #> ✔ 11:07:38 | Decoding of player ids completed #> name id #> 1 P.Mahomes 00-0033873 #> 2 B.Baldwin #> 3 P.Mahomes 00-0033873 #> 4 S.Carl #> 5 J.Jones 00-0027944 # }"},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":null,"dir":"Reference","previous_headings":"","what":"Get NFL Play by Play Data — fast_scraper","title":"Get NFL Play by Play Data — fast_scraper","text":"Load parse NFL play--play data add original nflfastR variables. nflfastR now provides multiple functions add information output function, recommended use build_nflfastR_pbp instead.","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get NFL Play by Play Data — fast_scraper","text":"","code":"fast_scraper( game_ids, dir = getOption(\"nflfastR.raw_directory\", default = NULL), ..., in_builder = FALSE )"},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get NFL Play by Play Data — fast_scraper","text":"game_ids Vector character ids data frame including variable game_id (see details information). dir Path local directory (defaults option \"nflfastR.raw_directory\") nflfastR searches raw game play--play data. See save_raw_pbp() additional information. ... Additional arguments passed scraping functions (internal use) in_builder TRUE, final message suppressed (usage inside build_nflfastR_pbp).","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Get NFL Play by Play Data — fast_scraper","text":"Data frame individual row represents single play passed game_ids containing following detailed information (description partly extracted nflscrapR): play_id Numeric play id used game_id drive provides unique identifier single play. game_id Ten digit identifier NFL game. old_game_id Legacy NFL game ID. home_team String abbreviation home team. away_team String abbreviation away team. season_type 'REG' 'POST' indicating game belongs regular post season. week Season week. posteam String abbreviation team possession. posteam_type String indicating whether posteam team home away. defteam String abbreviation team defense. side_of_field String abbreviation team's side field team possession currently . yardline_100 Numeric distance number yards opponent's endzone posteam. game_date Date game. quarter_seconds_remaining Numeric seconds remaining quarter. half_seconds_remaining Numeric seconds remaining half. game_seconds_remaining Numeric seconds remaining game. game_half String indicating half play , either Half1, Half2, Overtime. quarter_end Binary indicator whether row data marking end quarter. drive Numeric drive number game. sp Binary indicator whether score occurred play. qtr Quarter game (5 overtime). given play. goal_to_go Binary indicator whether posteam goal situation. time Time start play provided string format minutes:seconds remaining quarter. yrdln String indicating current field position given play. ydstogo Numeric yards distance either first marker endzone goal situations. ydsnet Numeric value total yards gained given drive. desc Detailed string description given play. play_type String indicating type play: pass (includes sacks), run (includes scrambles), punt, field_goal, kickoff, extra_point, qb_kneel, qb_spike, no_play (timeouts penalties), missing rows indicating end play. yards_gained Numeric yards gained (lost) possessing team, excluding yards gained via fumble recoveries laterals. shotgun Binary indicator whether play shotgun formation. no_huddle Binary indicator whether play no_huddle formation. qb_dropback Binary indicator whether QB dropped back play (pass attempt, sack, scrambled). qb_kneel Binary indicator whether QB took knee. qb_spike Binary indicator whether QB spiked ball. qb_scramble Binary indicator whether QB scrambled. pass_length String indicator pass length: short deep. pass_location String indicator pass location: left, middle, right. air_yards Numeric value distance yards perpendicular line scrimmage targeted receiver either caught catch ball. yards_after_catch Numeric value distance yards perpendicular yard line receiver made reception play ended. run_location String indicator location run: left, middle, right. run_gap String indicator line gap run: end, guard, tackle field_goal_result String indicator result field goal attempt: made, missed, blocked. kick_distance Numeric distance yards kickoffs, field goals, punts. extra_point_result String indicator result extra point attempt: good, failed, blocked, safety (touchback defensive endzone 1 point apparently), aborted. two_point_conv_result String indicator result two point conversion attempt: success, failure, safety (touchback defensive endzone 1 point apparently), return. home_timeouts_remaining Numeric timeouts remaining half home team. away_timeouts_remaining Numeric timeouts remaining half away team. timeout Binary indicator whether timeout called either team. timeout_team String abbreviation team called timeout. td_team String abbreviation team scored touchdown. td_player_name String name player scored touchdown. td_player_id Unique identifier player scored touchdown. posteam_timeouts_remaining Number timeouts remaining possession team. defteam_timeouts_remaining Number timeouts remaining team defense. total_home_score Score home team end play. total_away_score Score away team end play. posteam_score Score posteam start play. defteam_score Score defteam start play. score_differential Score differential posteam defteam start play. posteam_score_post Score posteam end play. defteam_score_post Score defteam end play. score_differential_post Score differential posteam defteam end play. no_score_prob Predicted probability score occurring rest half based expected points model. opp_fg_prob Predicted probability defteam scoring FG next. opp_safety_prob Predicted probability defteam scoring safety next. opp_td_prob Predicted probability defteam scoring TD next. fg_prob Predicted probability posteam scoring FG next. safety_prob Predicted probability posteam scoring safety next. td_prob Predicted probability posteam scoring TD next. extra_point_prob Predicted probability posteam scoring extra point. two_point_conversion_prob Predicted probability posteam scoring two point conversion. ep Using scoring event probabilities, estimated expected points respect possession team given play. epa Expected points added (EPA) posteam given play. total_home_epa Cumulative total EPA home team game far. total_away_epa Cumulative total EPA away team game far. total_home_rush_epa Cumulative total rushing EPA home team game far. total_away_rush_epa Cumulative total rushing EPA away team game far. total_home_pass_epa Cumulative total passing EPA home team game far. total_away_pass_epa Cumulative total passing EPA away team game far. air_epa EPA air yards alone. completions represents actual value provided air. incompletions represents hypothetical value 've added air pass completed. yac_epa EPA yards catch alone. completions represents actual value provided catch. incompletions represents difference hypothetical air_epa play's raw observed EPA (much incomplete pass cost posteam). comp_air_epa EPA air yards alone completions. comp_yac_epa EPA yards catch alone completions. total_home_comp_air_epa Cumulative total completions air EPA home team game far. total_away_comp_air_epa Cumulative total completions air EPA away team game far. total_home_comp_yac_epa Cumulative total completions yac EPA home team game far. total_away_comp_yac_epa Cumulative total completions yac EPA away team game far. total_home_raw_air_epa Cumulative total raw air EPA home team game far. total_away_raw_air_epa Cumulative total raw air EPA away team game far. total_home_raw_yac_epa Cumulative total raw yac EPA home team game far. total_away_raw_yac_epa Cumulative total raw yac EPA away team game far. wp Estimated win probabiity posteam given current situation start given play. def_wp Estimated win probability defteam. home_wp Estimated win probability home team. away_wp Estimated win probability away team. wpa Win probability added (WPA) posteam. vegas_wpa Win probability added (WPA) posteam: spread_adjusted model. vegas_home_wpa Win probability added (WPA) home team: spread_adjusted model. home_wp_post Estimated win probability home team end play. away_wp_post Estimated win probability away team end play. vegas_wp Estimated win probabiity posteam given current situation start given play, incorporating pre-game Vegas line. vegas_home_wp Estimated win probability home team incorporating pre-game Vegas line. total_home_rush_wpa Cumulative total rushing WPA home team game far. total_away_rush_wpa Cumulative total rushing WPA away team game far. total_home_pass_wpa Cumulative total passing WPA home team game far. total_away_pass_wpa Cumulative total passing WPA away team game far. air_wpa WPA air (logic air_epa). yac_wpa WPA yards catch (logic yac_epa). comp_air_wpa air_wpa completions . comp_yac_wpa yac_wpa completions . total_home_comp_air_wpa Cumulative total completions air WPA home team game far. total_away_comp_air_wpa Cumulative total completions air WPA away team game far. total_home_comp_yac_wpa Cumulative total completions yac WPA home team game far. total_away_comp_yac_wpa Cumulative total completions yac WPA away team game far. total_home_raw_air_wpa Cumulative total raw air WPA home team game far. total_away_raw_air_wpa Cumulative total raw air WPA away team game far. total_home_raw_yac_wpa Cumulative total raw yac WPA home team game far. total_away_raw_yac_wpa Cumulative total raw yac WPA away team game far. punt_blocked Binary indicator punt blocked. first_down_rush Binary indicator running play converted first . first_down_pass Binary indicator passing play converted first . first_down_penalty Binary indicator penalty converted first . third_down_converted Binary indicator first converted third . third_down_failed Binary indicator posteam failed convert first third . fourth_down_converted Binary indicator first converted fourth . fourth_down_failed Binary indicator posteam failed convert first fourth . incomplete_pass Binary indicator pass incomplete. touchback Binary indicator touchback occurred play. interception Binary indicator pass intercepted. punt_inside_twenty Binary indicator punt ended inside twenty yard line. punt_in_endzone Binary indicator punt endzone. punt_out_of_bounds Binary indicator punt went bounds. punt_downed Binary indicator punt downed. punt_fair_catch Binary indicator punt caught fair catch. kickoff_inside_twenty Binary indicator kickoff ended inside twenty yard line. kickoff_in_endzone Binary indicator kickoff endzone. kickoff_out_of_bounds Binary indicator kickoff went bounds. kickoff_downed Binary indicator kickoff downed. kickoff_fair_catch Binary indicator kickoff caught fair catch. fumble_forced Binary indicator fumble forced. fumble_not_forced Binary indicator fumble forced. fumble_out_of_bounds Binary indicator fumble went bounds. solo_tackle Binary indicator play solo tackle (multiple due fumbles). safety Binary indicator whether safety occurred. penalty Binary indicator whether penalty occurred. tackled_for_loss Binary indicator whether tackle loss run play occurred. fumble_lost Binary indicator fumble lost. own_kickoff_recovery Binary indicator kicking team recovered kickoff. own_kickoff_recovery_td Binary indicator kicking team recovered kickoff scored TD. qb_hit Binary indicator QB hit play. rush_attempt Binary indicator play run. pass_attempt Binary indicator play pass attempt (includes sacks). sack Binary indicator play ended sack. touchdown Binary indicator play resulted TD. pass_touchdown Binary indicator play resulted passing TD. rush_touchdown Binary indicator play resulted rushing TD. return_touchdown Binary indicator play resulted return TD. extra_point_attempt Binary indicator extra point attempt. two_point_attempt Binary indicator two point conversion attempt. field_goal_attempt Binary indicator field goal attempt. kickoff_attempt Binary indicator kickoff. punt_attempt Binary indicator punts. fumble Binary indicator fumble occurred. complete_pass Binary indicator pass completed. assist_tackle Binary indicator assist tackle occurred. lateral_reception Binary indicator lateral occurred reception. lateral_rush Binary indicator lateral occurred run. lateral_return Binary indicator lateral occurred return. lateral_recovery Binary indicator lateral occurred fumble recovery. passer_player_id Unique identifier player attempted pass. passer_player_name String name player attempted pass. passing_yards Numeric yards passer_player_name, including yards gained pass plays laterals. equal official passing statistics. receiver_player_id Unique identifier receiver targeted pass. receiver_player_name String name targeted receiver. receiving_yards Numeric yards receiver_player_name, excluding yards gained pass plays laterals. equal official receiving statistics miss yards gained pass plays laterals. Please see description lateral_receiver_player_name information. rusher_player_id Unique identifier player attempted run. rusher_player_name String name player attempted run. rushing_yards Numeric yards rusher_player_name, excluding yards gained rush plays laterals. equal official rushing statistics miss yards gained rush plays laterals. Please see description lateral_rusher_player_name information. lateral_receiver_player_id Unique identifier player received last(!) lateral pass play. lateral_receiver_player_name String name player received last(!) lateral pass play. multiple laterals play, last player received lateral. Please see https://github.com/mrcaseb/nfl-data/tree/master/data/lateral_yards list plays multiple players recorded lateral receiving yards. lateral_receiving_yards Numeric yards lateral_receiver_player_name pass plays laterals. Please see description lateral_receiver_player_name information. lateral_rusher_player_id Unique identifier player received last(!) lateral run play. lateral_rusher_player_name String name player received last(!) lateral run play. multiple laterals play, last player received lateral. Please see https://github.com/mrcaseb/nfl-data/tree/master/data/lateral_yards list plays multiple players recorded lateral rushing yards. lateral_rushing_yards Numeric yards lateral_rusher_player_name run plays laterals. Please see description lateral_rusher_player_name information. lateral_sack_player_id Unique identifier player received lateral sack. lateral_sack_player_name String name player received lateral sack. interception_player_id Unique identifier player intercepted pass. interception_player_name String name player intercepted pass. lateral_interception_player_id Unique indentifier player received lateral interception. lateral_interception_player_name String name player received lateral interception. punt_returner_player_id Unique identifier punt returner. punt_returner_player_name String name punt returner. lateral_punt_returner_player_id Unique identifier player received lateral punt return. lateral_punt_returner_player_name String name player received lateral punt return. kickoff_returner_player_name String name kickoff returner. kickoff_returner_player_id Unique identifier kickoff returner. lateral_kickoff_returner_player_id Unique identifier player received lateral kickoff return. lateral_kickoff_returner_player_name String name player received lateral kickoff return. punter_player_id Unique identifier punter. punter_player_name String name punter. kicker_player_name String name kicker FG kickoff. kicker_player_id Unique identifier kicker FG kickoff. own_kickoff_recovery_player_id Unique identifier player recovered kickoff. own_kickoff_recovery_player_name String name player recovered kickoff. blocked_player_id Unique identifier player blocked punt FG. blocked_player_name String name player blocked punt FG. tackle_for_loss_1_player_id Unique identifier one potential players tackle loss. tackle_for_loss_1_player_name String name one potential players tackle loss. tackle_for_loss_2_player_id Unique identifier one potential players tackle loss. tackle_for_loss_2_player_name String name one potential players tackle loss. qb_hit_1_player_id Unique identifier one potential players hit QB. sack QB ball carrier. sacks please see sack_player half_sack_*_player. qb_hit_1_player_name String name one potential players hit QB. sack QB ball carrier. sacks please see sack_player half_sack_*_player. qb_hit_2_player_id Unique identifier one potential players hit QB. sack QB ball carrier. sacks please see sack_player half_sack_*_player. qb_hit_2_player_name String name one potential players hit QB. sack QB ball carrier. sacks please see sack_player half_sack_*_player. forced_fumble_player_1_team Team one players forced fumble. forced_fumble_player_1_player_id Unique identifier one players forced fumble. forced_fumble_player_1_player_name String name one players forced fumble. forced_fumble_player_2_team Team one players forced fumble. forced_fumble_player_2_player_id Unique identifier one players forced fumble. forced_fumble_player_2_player_name String name one players forced fumble. solo_tackle_1_team Team one players solo tackle. solo_tackle_2_team Team one players solo tackle. solo_tackle_1_player_id Unique identifier one players solo tackle. solo_tackle_2_player_id Unique identifier one players solo tackle. solo_tackle_1_player_name String name one players solo tackle. solo_tackle_2_player_name String name one players solo tackle. assist_tackle_1_player_id Unique identifier one players tackle assist. assist_tackle_1_player_name String name one players tackle assist. assist_tackle_1_team Team one players tackle assist. assist_tackle_2_player_id Unique identifier one players tackle assist. assist_tackle_2_player_name String name one players tackle assist. assist_tackle_2_team Team one players tackle assist. assist_tackle_3_player_id Unique identifier one players tackle assist. assist_tackle_3_player_name String name one players tackle assist. assist_tackle_3_team Team one players tackle assist. assist_tackle_4_player_id Unique identifier one players tackle assist. assist_tackle_4_player_name String name one players tackle assist. assist_tackle_4_team Team one players tackle assist. tackle_with_assist Binary indicator tackle assist. tackle_with_assist_1_player_id Unique identifier one players tackle assist. tackle_with_assist_1_player_name String name one players tackle assist. tackle_with_assist_1_team Team one players tackle assist. tackle_with_assist_2_player_id Unique identifier one players tackle assist. tackle_with_assist_2_player_name String name one players tackle assist. tackle_with_assist_2_team Team one players tackle assist. pass_defense_1_player_id Unique identifier one players pass defense. pass_defense_1_player_name String name one players pass defense. pass_defense_2_player_id Unique identifier one players pass defense. pass_defense_2_player_name String name one players pass defense. fumbled_1_team Team one first player fumble. fumbled_1_player_id Unique identifier first player fumbled play. fumbled_1_player_name String name one first player fumbled play. fumbled_2_player_id Unique identifier second player fumbled play. fumbled_2_player_name String name one second player fumbled play. fumbled_2_team Team one second player fumble. fumble_recovery_1_team Team one players fumble recovery. fumble_recovery_1_yards Yards gained one players fumble recovery. fumble_recovery_1_player_id Unique identifier one players fumble recovery. fumble_recovery_1_player_name String name one players fumble recovery. fumble_recovery_2_team Team one players fumble recovery. fumble_recovery_2_yards Yards gained one players fumble recovery. fumble_recovery_2_player_id Unique identifier one players fumble recovery. fumble_recovery_2_player_name String name one players fumble recovery. sack_player_id Unique identifier player recorded solo sack. sack_player_name String name player recorded solo sack. half_sack_1_player_id Unique identifier first player recorded half sack. half_sack_1_player_name String name first player recorded half sack. half_sack_2_player_id Unique identifier second player recorded half sack. half_sack_2_player_name String name second player recorded half sack. return_team String abbreviation return team. return_yards Yards gained return team. penalty_team String abbreviation team penalty. penalty_player_id Unique identifier player penalty. penalty_player_name String name player penalty. penalty_yards Yards gained (lost) posteam penalty. replay_or_challenge Binary indicator whether replay challenge. replay_or_challenge_result String indicating result replay challenge. penalty_type String indicating penalty type first penalty given play. NA desc missing type. defensive_two_point_attempt Binary indicator whether defense able attempt two point conversion, results following turnover. defensive_two_point_conv Binary indicator whether defense successfully scored two point conversion. defensive_extra_point_attempt Binary indicator whether defense able attempt extra point attempt, results following blocked attempt defense recovers ball. defensive_extra_point_conv Binary indicator whether defense successfully scored extra point attempt. safety_player_name String name player scored safety. safety_player_id Unique identifier player scored safety. season 4 digit number indicating season game belongs . cp Numeric value indicating probability complete pass based comparable game situations. cpoe single pass play 1 - cp pass completed 0 - cp pass incomplete. Analyzed whole game season indicator passer much expectation completion percentage . series Starts 1, new first increments, numbers shared across teams NA: kickoffs, extra point/two point conversion attempts, non-plays, posteam series_success 1: scored touchdown, gained enough yards first . series_result Possible values: First , Touchdown, Opp touchdown, Field goal, Missed field goal, Safety, Turnover, Punt, Turnover downs, QB kneel, End half start_time Kickoff time eastern time zone. order_sequence Column provided NFL fix --order plays. Available 2011 beyond source \"nfl\". time_of_day Time day play UTC \"HH:MM:SS\" format. Available 2011 beyond source \"nfl\". stadium Game site name. weather String describing weather including temperature, humidity wind (direction speed). change game! nfl_api_id UUID game new NFL API. play_clock Time playclock ball snapped. play_deleted Binary indicator deleted plays. play_type_nfl Play type listed NFL source. Slightly different regular play_type variable. special_teams_play Binary indicator whether play special teams play NFL source. Available 2011 beyond source \"nfl\". st_play_type Type special teams play NFL source. Available 2011 beyond source \"nfl\". end_clock_time Game time end given play. end_yard_line String indicating yardline end given play consisting team half yard line number. drive_real_start_time Local day time drive started (currently used NFL therefore mostly 'NA'). drive_play_count Numeric value many regular plays happened given drive. drive_time_of_possession Time possession given drive. drive_first_downs Number forst downs given drive. drive_inside20 Binary indicator offense able get inside opponents 20 yard line. drive_ended_with_score Binary indicator drive ended score. drive_quarter_start Numeric value indicating quarter given drive started. drive_quarter_end Numeric value indicating quarter given drive ended. drive_yards_penalized Numeric value many yards offense gained lost penalties given drive. drive_start_transition String indicating offense got ball. drive_end_transition String indicating offense lost ball. drive_game_clock_start Game time beginning given drive. drive_game_clock_end Game time end given drive. drive_start_yard_line String indicating given drive started consisting team half yard line number. drive_end_yard_line String indicating given drive ended consisting team half yard line number. drive_play_id_started Play_id first play given drive. drive_play_id_ended Play_id last play given drive. fixed_drive Manually created drive number game. fixed_drive_result Manually created drive result. away_score Total points scored away team. home_score Total points scored home team. location Either 'Home' o 'Neutral' indicating home team played home neutral site. result Equals home_score - away_score means game outcome perspective home team. total Equals home_score + away_score means total points scored given game. spread_line closing spread line game. positive number means home team favored many points, negative number means away team favored many points. (Source: Pro-Football-Reference) total_line closing total line game. (Source: Pro-Football-Reference) div_game Binary indicator given game division game. roof One 'dome', 'outdoors', 'closed', 'open' indicating indicating roof status stadium game played . (Source: Pro-Football-Reference) surface type ground game played . (Source: Pro-Football-Reference) temp temperature stadium 'roof' = 'outdoors' 'open'.(Source: Pro-Football-Reference) wind speed wind miles/hour 'roof' = 'outdoors' 'open'. (Source: Pro-Football-Reference) home_coach First last name home team coach. (Source: Pro-Football-Reference) away_coach First last name away team coach. (Source: Pro-Football-Reference) stadium_id ID stadium game played . (Source: Pro-Football-Reference) game_stadium Name stadium game played . (Source: Pro-Football-Reference)","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get NFL Play by Play Data — fast_scraper","text":"load valid game_ids please use package function fast_scraper_schedules (function can directly handle output function)","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/fast_scraper.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get NFL Play by Play Data — fast_scraper","text":"","code":"# \\donttest{ # Get pbp data for two games try({# to avoid CRAN test problems fast_scraper(c(\"2019_01_GB_CHI\", \"2013_21_SEA_DEN\")) }) #> ℹ It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan(\"multisession\")`! Will go on sequentially... #> ✔ 11:07:40 | Download finished. Adding variables... #> ✔ 11:07:40 | added game variables #> ✔ 11:07:40 | added nflscrapR variables #> ✔ 11:07:40 | added ep variables #> ✔ 11:07:40 | added air_yac_ep variables #> ✔ 11:07:41 | added wp variables #> ✔ 11:07:41 | added air_yac_wp variables #> ✔ 11:07:41 | added cp and cpoe #> ✔ 11:07:41 | added fixed drive variables #> ✔ 11:07:41 | added series variables #> ✔ 11:07:41 | Procedure completed. #> ── nflverse play by play ─────────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 11:07:41 UTC #> # A tibble: 337 × 339 #> play_id game_id old_game_id home_team away_team season_type week posteam #> #> 1 1 2013_21_SE… 2014020200 DEN SEA POST 21 NA #> 2 37 2013_21_SE… 2014020200 DEN SEA POST 21 NA #> 3 61 2013_21_SE… 2014020200 DEN SEA POST 21 DEN #> 4 83 2013_21_SE… 2014020200 DEN SEA POST 21 DEN #> 5 119 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> 6 141 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> 7 162 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> 8 183 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> 9 210 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> 10 232 2013_21_SE… 2014020200 DEN SEA POST 21 SEA #> # ℹ 327 more rows #> # ℹ 331 more variables: posteam_type , defteam , side_of_field , #> # yardline_100 , game_date , quarter_seconds_remaining , #> # half_seconds_remaining , game_seconds_remaining , #> # game_half , quarter_end , drive , sp , qtr , #> # down , goal_to_go , time , yrdln , ydstogo , #> # ydsnet , desc , play_type , yards_gained , … # It is also possible to directly use the # output of `fast_scraper_schedules` as input try({# to avoid CRAN test problems library(dplyr, warn.conflicts = FALSE) fast_scraper_schedules(2020) %>% slice_tail(n = 3) %>% fast_scraper() }) #> ℹ It is recommended to use parallel processing when trying to load multiple games.Please consider running `future::plan(\"multisession\")`! Will go on sequentially... #> ✔ 11:07:43 | Download finished. Adding variables... #> ✔ 11:07:43 | added game variables #> ✔ 11:07:44 | added nflscrapR variables #> ✔ 11:07:44 | added ep variables #> ✔ 11:07:44 | added air_yac_ep variables #> ✔ 11:07:44 | added wp variables #> ✔ 11:07:44 | added air_yac_wp variables #> ✔ 11:07:44 | added cp and cpoe #> ✔ 11:07:44 | added fixed drive variables #> ✔ 11:07:45 | added series variables #> ✔ 11:07:45 | Procedure completed. #> ── nflverse play by play ─────────────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 11:07:45 UTC #> # A tibble: 539 × 339 #> play_id game_id old_game_id home_team away_team season_type week posteam #> #> 1 1 2020_20_BU… 2021012401 KC BUF POST 20 NA #> 2 42 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 3 57 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 4 78 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 5 102 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 6 123 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 7 145 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 8 174 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 9 207 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> 10 236 2020_20_BU… 2021012401 KC BUF POST 20 BUF #> # ℹ 529 more rows #> # ℹ 331 more variables: posteam_type , defteam , side_of_field , #> # yardline_100 , game_date , quarter_seconds_remaining , #> # half_seconds_remaining , game_seconds_remaining , #> # game_half , quarter_end , drive , sp , qtr , #> # down , goal_to_go , time , yrdln , ydstogo , #> # ydsnet , desc , play_type , yards_gained , … # \\dontshow{ # Close open connections for R CMD Check future::plan(\"sequential\") # } # }"},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":null,"dir":"Reference","previous_headings":"","what":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"Load Rosters","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"","code":"fast_scraper_roster(...)"},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"... Arguments passed nflreadr::load_rosters seasons numeric vector seasons return, defaults returning year's data March later. set TRUE, return available data. Data available back 1920. file_type One c(\"rds\", \"qs\", \"csv\", \"parquet\"). Can also set globally options(nflreadr.prefer)","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"tibble season-level roster data.","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"See nflreadr::load_rosters details.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/fast_scraper_roster.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Load Team Rosters for Multiple Seasons — fast_scraper_roster","text":"","code":"# \\donttest{ # Roster of the 2019 and 2020 seasons try({# to avoid CRAN test problems fast_scraper_roster(2019:2020) }) #> ── nflverse roster data ──────────────────────────────────────────────────────── #> ℹ Data updated: 2023-09-13 01:04:45 UTC #> # A tibble: 6,182 × 36 #> season team position depth_chart_position jersey_number status full_name #> #> 1 2019 IND K K 4 RES Adam Vinatie… #> 2 2019 NE QB QB 12 ACT Tom Brady #> 3 2019 NO QB QB 9 ACT Drew Brees #> 4 2019 ATL K K 3 CUT Matt Bryant #> 5 2019 PHI QB QB 18 ACT Josh McCown #> 6 2019 DAL TE TE 82 ACT Jason Witten #> 7 2019 KC LB OLB 94 ACT Terrell Suggs #> 8 2019 HOU DB FS 27 ACT Mike Adams #> 9 2019 DET LS LS 48 ACT Don Muhlbach #> 10 2019 PHI OL OT 71 ACT Jason Peters #> # ℹ 6,172 more rows #> # ℹ 29 more variables: first_name , last_name , birth_date , #> # height , weight , college , gsis_id , espn_id , #> # sportradar_id , yahoo_id , rotowire_id , pff_id , #> # pfr_id , fantasy_data_id , sleeper_id , years_exp , #> # headshot_url , ngs_position , week , game_type , #> # status_description_abbr , football_name , esb_id , … # }"},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":null,"dir":"Reference","previous_headings":"","what":"Load NFL Season Schedules — fast_scraper_schedules","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"returns game/schedule information maintained Lee Sharpe.","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"","code":"fast_scraper_schedules(...)"},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"... Arguments passed nflreadr::load_schedules seasons numeric vector seasons return, default TRUE returns available data.","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"tibble game information past /future games.","code":""},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"See nflreadr::load_schedules details.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/fast_scraper_schedules.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Load NFL Season Schedules — fast_scraper_schedules","text":"","code":"# \\donttest{ # Get schedules for the whole 2015 - 2018 seasons try({# to avoid CRAN test problems fast_scraper_schedules(2015:2018) }) #> ── nflverse games and schedules ──────────────────────────────────────────────── #> ℹ Data updated: 2024-03-11 11:07:47 UTC #> # A tibble: 1,068 × 46 #> game_id season game_type week gameday weekday gametime away_team away_score #> #> 1 2015_01… 2015 REG 1 2015-0… Thursd… 20:30 PIT 21 #> 2 2015_01… 2015 REG 1 2015-0… Sunday 13:00 IND 14 #> 3 2015_01… 2015 REG 1 2015-0… Sunday 13:00 GB 31 #> 4 2015_01… 2015 REG 1 2015-0… Sunday 13:00 KC 27 #> 5 2015_01… 2015 REG 1 2015-0… Sunday 13:00 CAR 20 #> 6 2015_01… 2015 REG 1 2015-0… Sunday 13:00 CLE 10 #> 7 2015_01… 2015 REG 1 2015-0… Sunday 13:00 SEA 31 #> 8 2015_01… 2015 REG 1 2015-0… Sunday 13:00 MIA 17 #> 9 2015_01… 2015 REG 1 2015-0… Sunday 16:05 NO 19 #> 10 2015_01… 2015 REG 1 2015-0… Sunday 16:05 DET 28 #> # ℹ 1,058 more rows #> # ℹ 37 more variables: home_team , home_score , location , #> # result , total , overtime , old_game_id , gsis , #> # nfl_detail_id , pfr , pff , espn , ftn , #> # away_rest , home_rest , away_moneyline , #> # home_moneyline , spread_line , away_spread_odds , #> # home_spread_odds , total_line , under_odds , … # }"},{"path":"https://www.nflfastr.com/reference/field_descriptions.html","id":null,"dir":"Reference","previous_headings":"","what":"nflfastR Field Descriptions — field_descriptions","title":"nflfastR Field Descriptions — field_descriptions","text":"nflfastR Field Descriptions","code":""},{"path":"https://www.nflfastr.com/reference/field_descriptions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"nflfastR Field Descriptions — field_descriptions","text":"","code":"field_descriptions"},{"path":"https://www.nflfastr.com/reference/field_descriptions.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"nflfastR Field Descriptions — field_descriptions","text":"data frame including names descriptions variables nflfastR dataset.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/field_descriptions.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"nflfastR Field Descriptions — field_descriptions","text":"","code":"# \\donttest{ field_descriptions #> # A tibble: 372 × 2 #> Field Description #> #> 1 play_id Numeric play id that when used with game_id and drive provides … #> 2 game_id Ten digit identifier for NFL game. #> 3 old_game_id Legacy NFL game ID. #> 4 home_team String abbreviation for the home team. #> 5 away_team String abbreviation for the away team. #> 6 season_type 'REG' or 'POST' indicating if the game belongs to regular or po… #> 7 week Season week. #> 8 posteam String abbreviation for the team with possession. #> 9 posteam_type String indicating whether the posteam team is home or away. #> 10 defteam String abbreviation for the team on defense. #> # ℹ 362 more rows # }"},{"path":"https://www.nflfastr.com/reference/load_pbp.html","id":null,"dir":"Reference","previous_headings":"","what":"Load Play By Play — load_pbp","title":"Load Play By Play — load_pbp","text":"Loads play play seasons nflverse-data repository","code":""},{"path":"https://www.nflfastr.com/reference/load_pbp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load Play By Play — load_pbp","text":"","code":"load_pbp(...)"},{"path":"https://www.nflfastr.com/reference/load_pbp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load Play By Play — load_pbp","text":"... Arguments passed nflreadr::load_pbp seasons numeric vector 4-digit years associated given NFL seasons - defaults latest season. set TRUE, returns available data since 1999. file_type One c(\"rds\", \"qs\", \"csv\", \"parquet\"). Can also set globally options(nflreadr.prefer)","code":""},{"path":"https://www.nflfastr.com/reference/load_pbp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load Play By Play — load_pbp","text":"complete nflfastR dataset returned nflfastR::build_nflfastR_pbp() (see ) given seasons","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/load_pbp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Load Play By Play — load_pbp","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems pbp <- load_pbp(2019:2020) dplyr::glimpse(pbp) }) #> Rows: 94,965 #> Columns: 372 #> $ play_id 1, 36, 51, 79, 100, 121, 148, 185… #> $ game_id \"2019_01_ATL_MIN\", \"2019_01_ATL_M… #> $ old_game_id \"2019090804\", \"2019090804\", \"2019… #> $ home_team \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"MIN\"… #> $ away_team \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"ATL\"… #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\"… #> $ week 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, … #> $ posteam NA, \"ATL\", \"ATL\", \"ATL\", \"ATL\", \"… #> $ posteam_type NA, \"away\", \"away\", \"away\", \"away… #> $ defteam NA, \"MIN\", \"MIN\", \"MIN\", \"MIN\", \"… #> $ side_of_field NA, \"MIN\", \"ATL\", \"ATL\", \"ATL\", \"… #> $ yardline_100 NA, 35, 75, 83, 79, 67, 21, 31, 2… #> $ game_date \"2019-09-08\", \"2019-09-08\", \"2019… #> $ quarter_seconds_remaining 900, 900, 900, 860, 821, 779, 773… #> $ half_seconds_remaining 1800, 1800, 1800, 1760, 1721, 167… #> $ game_seconds_remaining 3600, 3600, 3600, 3560, 3521, 347… #> $ game_half \"Half1\", \"Half1\", \"Half1\", \"Half1… #> $ quarter_end 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ drive NA, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3,… #> $ sp 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, … #> $ qtr 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, … #> $ down NA, NA, 1, 2, 3, 4, 1, 1, 2, NA, … #> $ goal_to_go 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ time \"15:00\", \"15:00\", \"15:00\", \"14:20… #> $ yrdln \"MIN 35\", \"MIN 35\", \"ATL 25\", \"AT… #> $ ydstogo 0, 0, 10, 18, 14, 2, 10, 20, 12, … #> $ ydsnet NA, 8, 8, 8, 8, 8, 21, 21, 21, 21… #> $ desc \"GAME\", \"5-D.Bailey kicks 65 yard… #> $ play_type NA, \"kickoff\", \"pass\", \"run\", \"ru… #> $ yards_gained NA, 0, -8, 4, 12, 0, 0, 8, 23, 0,… #> $ shotgun 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, … #> $ no_huddle 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ qb_dropback NA, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0,… #> $ qb_kneel 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ qb_spike 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ qb_scramble 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, … #> $ pass_length NA, NA, NA, NA, NA, NA, NA, \"shor… #> $ pass_location NA, NA, NA, NA, NA, NA, NA, \"left… #> $ air_yards NA, NA, NA, NA, NA, NA, NA, 1, 11… #> $ yards_after_catch NA, NA, NA, NA, NA, NA, NA, 7, 12… #> $ run_location NA, NA, NA, \"right\", \"left\", NA, … #> $ run_gap NA, NA, NA, \"tackle\", \"end\", NA, … #> $ field_goal_result NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ kick_distance NA, 65, NA, NA, NA, 0, NA, NA, NA… #> $ extra_point_result NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ two_point_conv_result NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ home_timeouts_remaining 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, … #> $ away_timeouts_remaining 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, … #> $ timeout NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ timeout_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ td_team NA, NA, NA, NA, NA, NA, NA, NA, \"… #> $ td_player_name NA, NA, NA, NA, NA, NA, NA, NA, \"… #> $ td_player_id NA, NA, NA, NA, NA, NA, NA, NA, \"… #> $ posteam_timeouts_remaining NA, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,… #> $ defteam_timeouts_remaining NA, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,… #> $ total_home_score 0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 7, … #> $ total_away_score 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ posteam_score NA, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0,… #> $ defteam_score NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,… #> $ score_differential NA, 0, 0, 0, 0, 0, 0, 0, 0, 6, -7… #> $ posteam_score_post NA, 0, 0, 0, 0, 0, 0, 0, 6, 7, 0,… #> $ defteam_score_post NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7,… #> $ score_differential_post NA, 0, 0, 0, 0, 0, 0, 0, 6, 7, -7… #> $ no_score_prob 0.000000000, 0.003473236, 0.00347… #> $ opp_fg_prob 0.00000000, 0.12887874, 0.1288787… #> $ opp_safety_prob 0.0000000000, 0.0022700424, 0.002… #> $ opp_td_prob 0.00000000, 0.27208826, 0.2720882… #> $ fg_prob 0.0000000, 0.2081953, 0.2081953, … #> $ safety_prob 0.0000000000, 0.0032402442, 0.003… #> $ td_prob 0.0000000, 0.3818542, 0.3818542, … #> $ extra_point_prob 0.0000000, 0.0000000, 0.0000000, … #> $ two_point_conversion_prob 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ ep 1.0082514, 1.0082514, 1.0082514, … #> $ epa 0.00000000, 0.00000000, -1.658763… #> $ total_home_epa 0.000000, 0.000000, 1.658763, 2.1… #> $ total_away_epa 0.000000, 0.000000, -1.658763, -2… #> $ total_home_rush_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_away_rush_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_home_pass_epa 0.000000, 0.000000, 1.658763, 1.6… #> $ total_away_pass_epa 0.000000, 0.000000, -1.658763, -1… #> $ air_epa NA, NA, NA, NA, NA, NA, NA, -0.55… #> $ yac_epa NA, NA, NA, NA, NA, NA, NA, 0.811… #> $ comp_air_epa NA, 0.0000000, 0.0000000, 0.00000… #> $ comp_yac_epa NA, 0.0000000, 0.0000000, 0.00000… #> $ total_home_comp_air_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_away_comp_air_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_home_comp_yac_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_away_comp_yac_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_home_raw_air_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_away_raw_air_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_home_raw_yac_epa 0.0000000, 0.0000000, 0.0000000, … #> $ total_away_raw_yac_epa 0.0000000, 0.0000000, 0.0000000, … #> $ wp 0.4332080, 0.4332080, 0.4332080, … #> $ def_wp 0.5667920, 0.5667920, 0.5667920, … #> $ home_wp 0.5667920, 0.5667920, 0.5667920, … #> $ away_wp 0.4332080, 0.4332080, 0.4332080, … #> $ wpa 0.0000000000, 0.0000000000, -0.03… #> $ vegas_wpa 0.0000000000, 0.0000000000, -0.04… #> $ vegas_home_wpa 0.0000000000, 0.0000000000, 0.049… #> $ home_wp_post NA, 0.5667920, 0.6018074, 0.62024… #> $ away_wp_post NA, 0.4332080, 0.3981926, 0.37975… #> $ vegas_wp 0.36757040, 0.36757040, 0.3675704… #> $ vegas_home_wp 0.6324296, 0.6324296, 0.6324296, … #> $ total_home_rush_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_away_rush_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_home_pass_wpa 0.00000000, 0.00000000, 0.0350153… #> $ total_away_pass_wpa 0.00000000, 0.00000000, -0.035015… #> $ air_wpa NA, NA, NA, NA, NA, NA, NA, 0.000… #> $ yac_wpa NA, NA, NA, NA, NA, NA, NA, 0.006… #> $ comp_air_wpa NA, 0.0000000000, 0.0000000000, 0… #> $ comp_yac_wpa NA, 0.0000000000, 0.0000000000, 0… #> $ total_home_comp_air_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_away_comp_air_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_home_comp_yac_wpa 0.000000000, 0.000000000, 0.00000… #> $ total_away_comp_yac_wpa 0.000000000, 0.000000000, 0.00000… #> $ total_home_raw_air_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_away_raw_air_wpa 0.0000000000, 0.0000000000, 0.000… #> $ total_home_raw_yac_wpa 0.000000000, 0.000000000, 0.00000… #> $ total_away_raw_yac_wpa 0.000000000, 0.000000000, 0.00000… #> $ punt_blocked NA, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,… #> $ first_down_rush NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ first_down_pass NA, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,… #> $ first_down_penalty NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ third_down_converted NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ third_down_failed NA, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,… #> $ fourth_down_converted NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ fourth_down_failed NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ incomplete_pass NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ touchback 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ interception NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ punt_inside_twenty NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ punt_in_endzone NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ punt_out_of_bounds NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ punt_downed NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ punt_fair_catch NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ kickoff_inside_twenty NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,… #> $ kickoff_in_endzone NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,… #> $ kickoff_out_of_bounds NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ kickoff_downed NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ kickoff_fair_catch NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ fumble_forced NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ fumble_not_forced NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ fumble_out_of_bounds NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ solo_tackle NA, 0, 1, 1, 1, 1, 0, 1, 0, 0, 1,… #> $ safety NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ penalty NA, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,… #> $ tackled_for_loss NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ fumble_lost NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ own_kickoff_recovery NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ own_kickoff_recovery_td NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ qb_hit NA, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,… #> $ rush_attempt NA, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,… #> $ pass_attempt NA, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0,… #> $ sack NA, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ touchdown NA, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,… #> $ pass_touchdown NA, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,… #> $ rush_touchdown NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ return_touchdown NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ extra_point_attempt NA, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,… #> $ two_point_attempt NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ field_goal_attempt NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ kickoff_attempt NA, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,… #> $ punt_attempt NA, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,… #> $ fumble NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ complete_pass NA, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,… #> $ assist_tackle NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ lateral_reception NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ lateral_rush NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ lateral_return NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ lateral_recovery NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ passer_player_id NA, NA, \"00-0026143\", NA, NA, NA,… #> $ passer_player_name NA, NA, \"M.Ryan\", NA, NA, NA, NA,… #> $ passing_yards NA, NA, NA, NA, NA, NA, NA, 8, 23… #> $ receiver_player_id NA, NA, NA, NA, NA, NA, NA, \"00-0… #> $ receiver_player_name NA, NA, NA, NA, NA, NA, NA, \"D.Co… #> $ receiving_yards NA, NA, NA, NA, NA, NA, NA, 8, 23… #> $ rusher_player_id NA, NA, NA, \"00-0031285\", \"00-002… #> $ rusher_player_name NA, NA, NA, \"D.Freeman\", \"M.Ryan\"… #> $ rushing_yards NA, NA, NA, 4, 12, NA, NA, NA, NA… #> $ lateral_receiver_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_receiver_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_receiving_yards NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_rusher_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_rusher_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_rushing_yards NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_sack_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_sack_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ interception_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ interception_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_interception_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_interception_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ punt_returner_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ punt_returner_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_punt_returner_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_punt_returner_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ kickoff_returner_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ kickoff_returner_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_kickoff_returner_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ lateral_kickoff_returner_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ punter_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ punter_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ kicker_player_name NA, \"D.Bailey\", NA, NA, NA, NA, N… #> $ kicker_player_id NA, \"00-0028660\", NA, NA, NA, NA,… #> $ own_kickoff_recovery_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ own_kickoff_recovery_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ blocked_player_id NA, NA, NA, NA, NA, \"00-0033336\",… #> $ blocked_player_name NA, NA, NA, NA, NA, \"E.Wilson\", N… #> $ tackle_for_loss_1_player_id NA, NA, \"00-0031256\", NA, NA, NA,… #> $ tackle_for_loss_1_player_name NA, NA, \"A.Barr\", NA, NA, NA, NA,… #> $ tackle_for_loss_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_for_loss_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ qb_hit_1_player_id NA, NA, \"00-0031256\", NA, NA, NA,… #> $ qb_hit_1_player_name NA, NA, \"A.Barr\", NA, NA, NA, NA,… #> $ qb_hit_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ qb_hit_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_1_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ forced_fumble_player_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ solo_tackle_1_team NA, NA, \"MIN\", \"MIN\", \"MIN\", \"ATL… #> $ solo_tackle_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ solo_tackle_1_player_id NA, NA, \"00-0031256\", \"00-0031242… #> $ solo_tackle_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ solo_tackle_1_player_name NA, NA, \"A.Barr\", \"S.Stephen\", \"A… #> $ solo_tackle_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_1_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_3_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_3_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_3_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_4_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_4_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ assist_tackle_4_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ tackle_with_assist_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist_1_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ tackle_with_assist_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ pass_defense_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ pass_defense_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ pass_defense_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ pass_defense_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_1_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumbled_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_1_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_1_yards NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_2_team NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_2_yards NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ fumble_recovery_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ sack_player_id NA, NA, \"00-0031256\", NA, NA, NA,… #> $ sack_player_name NA, NA, \"A.Barr\", NA, NA, NA, NA,… #> $ half_sack_1_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ half_sack_1_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ half_sack_2_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ half_sack_2_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ return_team NA, \"ATL\", NA, NA, NA, NA, NA, NA… #> $ return_yards NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18… #> $ penalty_team NA, NA, NA, NA, NA, NA, \"MIN\", NA… #> $ penalty_player_id NA, NA, NA, NA, NA, NA, \"00-00279… #> $ penalty_player_name NA, NA, NA, NA, NA, NA, \"K.Rudolp… #> $ penalty_yards NA, NA, NA, NA, NA, NA, 10, NA, N… #> $ replay_or_challenge 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ replay_or_challenge_result NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ penalty_type NA, NA, NA, NA, NA, NA, \"Offensiv… #> $ defensive_two_point_attempt NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ defensive_two_point_conv NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ defensive_extra_point_attempt NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ defensive_extra_point_conv NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ safety_player_name NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ safety_player_id NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ season 2019, 2019, 2019, 2019, 2019, 201… #> $ cp NA, NA, NA, NA, NA, NA, NA, 0.844… #> $ cpoe NA, NA, NA, NA, NA, NA, NA, 15.57… #> $ series 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, … #> $ series_success 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, … #> $ series_result \"Punt\", \"Punt\", \"Punt\", \"Punt\", \"… #> $ order_sequence 1, 36, 51, 79, 100, 121, 148, 185… #> $ start_time \"13:00:00\", \"13:00:00\", \"13:00:00… #> $ time_of_day NA, \"17:04:02\", \"17:04:42\", \"17:0… #> $ stadium \"U.S. Bank Stadium\", \"U.S. Bank S… #> $ weather \"N/A (Indoors) Temp: ° F, Wind: … #> $ nfl_api_id \"10160000-0579-055e-7350-c0a2552a… #> $ play_clock \"0\", \"10\", \"12\", \"5\", \"7\", \"17\", … #> $ play_deleted 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ play_type_nfl \"GAME_START\", \"KICK_OFF\", \"SACK\",… #> $ special_teams_play 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, … #> $ st_play_type NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ end_clock_time NA, NA, NA, NA, NA, \"12:53\", NA, … #> $ end_yard_line NA, \"ATL 25\", \"ATL 17\", \"ATL 21\",… #> $ fixed_drive 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, … #> $ fixed_drive_result \"Punt\", \"Punt\", \"Punt\", \"Punt\", \"… #> $ drive_real_start_time NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ drive_play_count NA, 3, 3, 3, 3, 3, 2, 2, 2, 2, 3,… #> $ drive_time_of_possession NA, \"2:07\", \"2:07\", \"2:07\", \"2:07… #> $ drive_first_downs NA, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,… #> $ drive_inside20 NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ drive_ended_with_score NA, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0,… #> $ drive_quarter_start NA, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,… #> $ drive_quarter_end NA, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,… #> $ drive_yards_penalized NA, 0, 0, 0, 0, 0, -10, -10, -10,… #> $ drive_start_transition NA, \"KICKOFF\", \"KICKOFF\", \"KICKOF… #> $ drive_end_transition NA, \"BLOCKED_PUNT\", \"BLOCKED_PUNT… #> $ drive_game_clock_start NA, \"15:00\", \"15:00\", \"15:00\", \"1… #> $ drive_game_clock_end NA, \"12:53\", \"12:53\", \"12:53\", \"1… #> $ drive_start_yard_line NA, \"ATL 25\", \"ATL 25\", \"ATL 25\",… #> $ drive_end_yard_line NA, \"ATL 33\", \"ATL 33\", \"ATL 33\",… #> $ drive_play_id_started NA, 36, 36, 36, 36, 36, 148, 148,… #> $ drive_play_id_ended NA, 121, 121, 121, 121, 121, 239,… #> $ away_score 12, 12, 12, 12, 12, 12, 12, 12, 1… #> $ home_score 28, 28, 28, 28, 28, 28, 28, 28, 2… #> $ location \"Home\", \"Home\", \"Home\", \"Home\", \"… #> $ result 16, 16, 16, 16, 16, 16, 16, 16, 1… #> $ total 40, 40, 40, 40, 40, 40, 40, 40, 4… #> $ spread_line 3.5, 3.5, 3.5, 3.5, 3.5, 3.5, 3.5… #> $ total_line 47, 47, 47, 47, 47, 47, 47, 47, 4… #> $ div_game 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ roof \"dome\", \"dome\", \"dome\", \"dome\", \"… #> $ surface \"sportturf\", \"sportturf\", \"sportt… #> $ temp NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ wind NA, NA, NA, NA, NA, NA, NA, NA, N… #> $ home_coach \"Mike Zimmer\", \"Mike Zimmer\", \"Mi… #> $ away_coach \"Dan Quinn\", \"Dan Quinn\", \"Dan Qu… #> $ stadium_id \"MIN01\", \"MIN01\", \"MIN01\", \"MIN01… #> $ game_stadium \"U.S. Bank Stadium\", \"U.S. Bank S… #> $ aborted_play 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ success 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, … #> $ passer NA, NA, \"M.Ryan\", NA, \"M.Ryan\", N… #> $ passer_jersey_number NA, NA, 2, NA, 2, NA, NA, 8, 8, N… #> $ rusher NA, NA, NA, \"D.Freeman\", NA, NA, … #> $ rusher_jersey_number NA, NA, NA, 24, 2, NA, 33, NA, NA… #> $ receiver NA, NA, NA, NA, NA, NA, NA, \"D.Co… #> $ receiver_jersey_number NA, NA, NA, NA, NA, NA, NA, 33, 1… #> $ pass 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, … #> $ rush 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, … #> $ first_down NA, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,… #> $ special 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, … #> $ play 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, … #> $ passer_id NA, NA, \"00-0026143\", NA, \"00-002… #> $ rusher_id NA, NA, NA, \"00-0031285\", NA, NA,… #> $ receiver_id NA, NA, NA, NA, NA, NA, NA, \"00-0… #> $ name NA, NA, \"M.Ryan\", \"D.Freeman\", \"M… #> $ jersey_number NA, NA, 2, 24, 2, NA, 33, 8, 8, N… #> $ id NA, NA, \"00-0026143\", \"00-0031285… #> $ fantasy_player_name NA, NA, NA, \"D.Freeman\", \"M.Ryan\"… #> $ fantasy_player_id NA, NA, NA, \"00-0031285\", \"00-002… #> $ fantasy NA, NA, NA, \"D.Freeman\", \"M.Ryan\"… #> $ fantasy_id NA, NA, NA, \"00-0031285\", \"00-002… #> $ out_of_bounds 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, … #> $ home_opening_kickoff 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ qb_epa 0.00000000, 0.00000000, -1.658763… #> $ xyac_epa NA, NA, NA, NA, NA, NA, NA, 0.747… #> $ xyac_mean_yardage NA, NA, NA, NA, NA, NA, NA, 6.732… #> $ xyac_median_yardage NA, NA, NA, NA, NA, NA, NA, 6, 0,… #> $ xyac_success NA, NA, NA, NA, NA, NA, NA, 0.505… #> $ xyac_fd NA, NA, NA, NA, NA, NA, NA, 0.053… #> $ xpass NA, NA, 0.4867992, 0.6399938, 0.9… #> $ pass_oe NA, NA, 51.320082, -63.999379, 6.… # }"},{"path":"https://www.nflfastr.com/reference/load_player_stats.html","id":null,"dir":"Reference","previous_headings":"","what":"Load Player Level Weekly Stats — load_player_stats","title":"Load Player Level Weekly Stats — load_player_stats","text":"Load Player Level Weekly Stats","code":""},{"path":"https://www.nflfastr.com/reference/load_player_stats.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Load Player Level Weekly Stats — load_player_stats","text":"","code":"load_player_stats(...)"},{"path":"https://www.nflfastr.com/reference/load_player_stats.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Load Player Level Weekly Stats — load_player_stats","text":"... Arguments passed nflreadr::load_player_stats seasons numeric vector seasons return, defaults recent season. set TRUE, returns available data. stat_type one \"offense\", \"defense\", \"kicking\" file_type One c(\"rds\", \"qs\", \"csv\", \"parquet\"). Can also set globally options(nflreadr.prefer)","code":""},{"path":"https://www.nflfastr.com/reference/load_player_stats.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Load Player Level Weekly Stats — load_player_stats","text":"tibble week-level player statistics aims match NFL official box scores.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/load_player_stats.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Load Player Level Weekly Stats — load_player_stats","text":"","code":"# \\donttest{ try({# to avoid CRAN test problems stats <- load_player_stats() dplyr::glimpse(stats) }) #> Warning: We have changed the behavior of `load_player_stats()` as of nflfastR 4.3.0. #> Calling it without an argument will return the current season only instead of #> all available seasons. #> Please try `load_player_stats(seasons = TRUE)` to get all seasons. #> This warning is displayed once every 8 hours. #> Rows: 5,653 #> Columns: 53 #> $ player_id \"00-0023459\", \"00-0024243\", \"00-0024243\", … #> $ player_name \"A.Rodgers\", \"M.Lewis\", \"M.Lewis\", \"M.Lewi… #> $ player_display_name \"Aaron Rodgers\", \"Marcedes Lewis\", \"Marced… #> $ position \"QB\", \"TE\", \"TE\", \"TE\", \"TE\", \"TE\", \"QB\", … #> $ position_group \"QB\", \"TE\", \"TE\", \"TE\", \"TE\", \"TE\", \"QB\", … #> $ headshot_url \"https://static.www.nfl.com/image/private/… #> $ recent_team \"NYJ\", \"CHI\", \"CHI\", \"CHI\", \"CHI\", \"CHI\", … #> $ season 2023, 2023, 2023, 2023, 2023, 2023, 2023, … #> $ week 1, 4, 7, 11, 14, 16, 13, 14, 15, 16, 17, 1… #> $ season_type \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", \"REG\", … #> $ opponent_team \"BUF\", \"DEN\", \"LV\", \"DET\", \"DET\", \"ARI\", \"… #> $ completions 0, 0, 0, 0, 0, 0, 23, 26, 28, 27, 19, 34, … #> $ attempts 1, 0, 0, 0, 0, 0, 44, 45, 44, 42, 29, 46, … #> $ passing_yards 0, 0, 0, 0, 0, 0, 254, 311, 374, 368, 309,… #> $ passing_tds 0, 0, 0, 0, 0, 0, 2, 3, 2, 3, 3, 1, 0, 1, … #> $ interceptions 0, 0, 0, 0, 0, 0, 1, 1, 3, 2, 1, 2, 0, 2, … #> $ sacks 1, 0, 0, 0, 0, 0, 2, 1, 4, 0, 1, 4, 0, 1, … #> $ sack_yards 10, 0, 0, 0, 0, 0, 14, 4, 31, 0, 8, 39, 0,… #> $ sack_fumbles 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, … #> $ sack_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, … #> $ passing_air_yards 17, 0, 0, 0, 0, 0, 543, 334, 382, 472, 179… #> $ passing_yards_after_catch 0, 0, 0, 0, 0, 0, 70, 158, 158, 108, 184, … #> $ passing_first_downs 0, 0, 0, 0, 0, 0, 10, 11, 12, 18, 9, 14, 1… #> $ passing_epa -2.031960, NA, NA, NA, NA, NA, -7.791564, … #> $ passing_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, … #> $ pacr 0.0000000, NA, NA, NA, NA, NA, 0.4677716, … #> $ dakota NA, NA, NA, NA, NA, NA, -0.024772334, 0.00… #> $ carries 0, 0, 0, 0, 0, 0, 0, 4, 1, 2, 2, 3, 3, 4, … #> $ rushing_yards 0, 0, 0, 0, 0, 0, 0, -1, -1, 1, 3, 13, 11,… #> $ rushing_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ rushing_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, … #> $ rushing_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ rushing_first_downs 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 2, 1, 1, … #> $ rushing_epa NA, NA, NA, NA, NA, NA, NA, -0.2038061, -0… #> $ rushing_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receptions 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ targets 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_yards 0, 8, 16, 0, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0,… #> $ receiving_tds 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_fumbles 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_fumbles_lost 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_air_yards 0, -3, 5, 9, -3, 1, 0, 0, 0, 0, 0, 0, 0, 0… #> $ receiving_yards_after_catch 0, 11, 11, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0… #> $ receiving_first_downs 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ receiving_epa NA, 0.4834648, 1.4372238, -0.5473667, -0.1… #> $ receiving_2pt_conversions 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ racr NA, 0.0, 3.2, 0.0, 0.0, 1.0, NA, NA, NA, N… #> $ target_share NA, 0.03125000, 0.03448276, 0.04545455, 0.… #> $ air_yards_share NA, -0.012396694, 0.094339623, 0.036885246… #> $ wopr NA, 0.03819731, 0.11776187, 0.09400149, 0.… #> $ special_teams_tds 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … #> $ fantasy_points 0.00, 0.80, 1.60, 0.00, 0.40, 6.10, 16.16,… #> $ fantasy_points_ppr 0.00, 1.80, 2.60, 0.00, 1.40, 7.10, 16.16,… # }"},{"path":"https://www.nflfastr.com/reference/missing_raw_pbp.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","title":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","text":"Uses nflreadr::load_schedules() load game IDs finished games compares IDs files saved dir. function intended serve input save_raw_pbp().","code":""},{"path":"https://www.nflfastr.com/reference/missing_raw_pbp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","text":"","code":"missing_raw_pbp( dir = getOption(\"nflfastR.raw_directory\", default = NULL), seasons = TRUE, verbose = TRUE )"},{"path":"https://www.nflfastr.com/reference/missing_raw_pbp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","text":"dir Path local directory (defaults option \"nflfastR.raw_directory\"). nflfastR download raw game files split season one sub directory per season. seasons numeric vector seasons return, default TRUE returns available data. verbose TRUE, print number missing game files well oldest recent missing ID console.","code":""},{"path":"https://www.nflfastr.com/reference/missing_raw_pbp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","text":"character vector missing game IDs. files missing, returns NULL invisibly.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/missing_raw_pbp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute Missing Raw PBP Data on Local Filesystem — missing_raw_pbp","text":"","code":"# \\donttest{ try( missing <- missing_raw_pbp(tempdir()) ) #> ℹ You are missing 6706 game files. The oldest missing game is \"1999_01_MIN_ATL\". The most recent missing game is \"2023_22_SF_KC\". # }"},{"path":"https://www.nflfastr.com/reference/nflfastR-package.html","id":null,"dir":"Reference","previous_headings":"","what":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","title":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","text":"set functions access National Football League play--play data https://www.nfl.com/.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/nflfastR-package.html","id":"preface","dir":"Reference","previous_headings":"","what":"Preface","title":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","text":"Prior nflfastR v4.0, parallel processing activated argument pp relevant functions progress updates always shown. methods bad practice therefore removed nflfastR v4.0 next sections describe make nflfastR work parallel processes show progress updates user wants .","code":""},{"path":"https://www.nflfastr.com/reference/nflfastR-package.html","id":"more-speed-using-parallel-processing","dir":"Reference","previous_headings":"","what":"More Speed Using Parallel Processing","title":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","text":"Nearly nflfastR functions support parallel processing using furrr::future_map() enabled call future::plan() prior function call. Please see documentation functions detailed information. example, following code block resolve function calls current session using multiple sessions background load play--play data 2018 2020 seasons build freshly 2018 2019 Super Bowls: recommend choosing default parallel processing method saving environment variable R user profile make sure futures resolved chosen method default. can done following given steps. First, run following line file .Renviron opened automatically. saved environment variables yet, empty file. opened file .Renviron add next line, save file restart R session. Please note example sets \"multisession\" default. users appropriate plan please make sure truly . session freshly restarted please check method worked running next line. output FALSE successfully set default non-sequential future::plan(). output TRUE functions behave like called purrr::map() multisession. information possible plans please see future package Readme. information .Renviron please see book chapter.","code":"future::plan(\"multisession\") load_pbp(2018:2020) build_nflfastR_pbp(c(\"2018_21_NE_LA\", \"2019_21_SF_KC\")) usethis::edit_r_environ() R_FUTURE_PLAN=\"multisession\" inherits(future::plan(), \"sequential\")"},{"path":"https://www.nflfastr.com/reference/nflfastR-package.html","id":"get-progress-updates-while-functions-are-running","dir":"Reference","previous_headings":"","what":"Get Progress Updates while Functions are Running","title":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","text":"nflfastR functions able show progress updates using progressr::progressor() turned function called. least two basic ways either activating progress updates globally (current session) piping function call progressr::with_progress(): Just like previous section, possible activate global progression handlers default. can done following given steps. First, run following line file .Rprofile opened automatically. saved code yet, empty file. opened file .Rprofile add next line, save file restart R session. code file executed new R session starts. part (require(\"progressr\")) makes sure run package progressr installed avoid crashing R sessions. session freshly restarted please check method worked running next line. output TRUE successfully activated global progression handlers sessions. information work progress handlers please see progressr::progressr. information .Rprofile please see book chapter.","code":"progressr::handlers(global = TRUE) load_pbp(2018:2020) %>% progressr::with_progress() usethis::edit_r_profile() if (requireNamespace(\"progressr\", quietly = TRUE)) progressr::handlers(global = TRUE) progressr::handlers(global = NA)"},{"path":[]},{"path":"https://www.nflfastr.com/reference/nflfastR-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"nflfastR: Functions to Efficiently Access NFL Play by Play Data — nflfastR-package","text":"Maintainer: Ben Baldwin bbaldwin206@gmail.com Authors: Sebastian Carl mrcaseb@gmail.com contributors: Lee Sharpe [contributor] Maksim Horowitz maksim.horowitz@gmail.com [contributor] Ron Yurko ryurko@stat.cmu.edu [contributor] Samuel Ventura samventura22@gmail.com [contributor] Tan Ho [contributor] John Edwards edwards1860@gmail.com [contributor]","code":""},{"path":"https://www.nflfastr.com/reference/report.html","id":null,"dir":"Reference","previous_headings":"","what":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","title":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","text":"function gives quick overview versions R operating system well versions nflverse packages, options, dependencies. primarily designed help get quick idea going helping someone else debug problem.","code":""},{"path":"https://www.nflfastr.com/reference/report.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","text":"","code":"report(...)"},{"path":"https://www.nflfastr.com/reference/report.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","text":"... Arguments passed nflreadr::nflverse_sitrep pkg character vector naming installed packages, NULL (default) meaning nflverse packages. function checks internally packages installed informs case. recursive logical indicating whether dependencies pkg dependencies () included. Can also character vector listing types dependencies, subset c(\"Depends\", \"Imports\", \"LinkingTo\", \"Suggests\", \"Enhances\"). Character string \"\" shorthand vector, character string \"\" vector without \"Enhances\", character string \"strong\" (default) first three elements vector. redact_path logical indicating whether options contain \"path\" name redacted, default = TRUE","code":""},{"path":"https://www.nflfastr.com/reference/report.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","text":"See nflreadr::nflverse_sitrep details.","code":""},{"path":"https://www.nflfastr.com/reference/report.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Get a Situation Report on System, nflverse Package Versions and Dependencies — report","text":"","code":"# \\donttest{ # \\dontshow{ # set CRAN mirror to avoid failing checks in weird scenarios old_ops <- options(repos = c(\"CRAN\" = \"https://cran.rstudio.com/\")) # } report(recursive = FALSE) #> ── System Info ───────────────────────────────────────────────────────────────── #> • R version 4.3.3 (2024-02-29) • Running under: Ubuntu 22.04.4 LTS #> ── Package Status ────────────────────────────────────────────────────────────── #> package installed cran dev behind #> 1 nflfastR 4.6.1.9007 4.6.1 4.6.1.9007 #> 2 nflplotR 1.3.0 1.3.0 1.3.0 #> 3 nflreadr 1.4.0.11 1.4.0 1.4.0.11 #> 4 nflseedR 1.2.0 1.2.0 1.2.0.9000 dev #> ── Package Options ───────────────────────────────────────────────────────────── #> • No options set for above packages #> ── Not Installed ─────────────────────────────────────────────────────────────── #> • nfl4th () #> • nflverse () #> ──────────────────────────────────────────────────────────────────────────────── nflverse_sitrep(pkg = \"nflreadr\", recursive = TRUE) #> ── System Info ───────────────────────────────────────────────────────────────── #> • R version 4.3.3 (2024-02-29) • Running under: Ubuntu 22.04.4 LTS #> ── Package Status ────────────────────────────────────────────────────────────── #> package installed cran dev behind #> 1 nflreadr 1.4.0.11 1.4.0 1.4.0.11 #> ── Package Options ───────────────────────────────────────────────────────────── #> • No options set for above packages #> ── Package Dependencies ──────────────────────────────────────────────────────── #> • cachem (1.0.8) • glue (1.7.0) • graphics (4.3.3) #> • cli (3.6.2) • memoise (2.0.1) • methods (4.3.3) #> • curl (5.2.1) • rappdirs (0.3.3) • stats (4.3.3) #> • data.table (1.15.2) • rlang (1.1.3) • tools (4.3.3) #> • fastmap (1.1.1) • grDevices (4.3.3) • utils (4.3.3) #> ──────────────────────────────────────────────────────────────────────────────── # \\dontshow{ # restore old options options(old_ops) # } # }"},{"path":"https://www.nflfastr.com/reference/save_raw_pbp.html","id":null,"dir":"Reference","previous_headings":"","what":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","title":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","text":"functions build_nflfastR_pbp() fast_scraper() support loading raw pbp data local file systems instead Github servers. function intended help setting . loads raw pbp data saves given directory split season subdirectories.","code":""},{"path":"https://www.nflfastr.com/reference/save_raw_pbp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","text":"","code":"save_raw_pbp( game_ids, dir = getOption(\"nflfastR.raw_directory\", default = NULL) )"},{"path":"https://www.nflfastr.com/reference/save_raw_pbp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","text":"game_ids vector nflverse game IDs. dir Path local directory (defaults option \"nflfastR.raw_directory\"). nflfastR download raw game files split season one sub directory per season.","code":""},{"path":"https://www.nflfastr.com/reference/save_raw_pbp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","text":"function returns data frame one row downloaded file following columns: success HTTP request successfully performed, regardless response status code. FALSE case network error, case tried resume server support . value NA means download interrupted progress. status_code HTTP status code request. successful download usually 200 full requests 206 resumed requests. Anything else indicate downloaded file contains error page instead requested content. resumefrom file size request, case download resumed. url final url (redirects) request. destfile downloaded file disk. error success == FALSE column contains error message. type Content-Type response header value. modified Last-Modified response header value. time total elapsed download time file seconds. headers vector http response headers request.","code":""},{"path":[]},{"path":"https://www.nflfastr.com/reference/save_raw_pbp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Download Raw PBP Data to Local Filesystem — save_raw_pbp","text":"","code":"# \\donttest{ # CREATE LOCAL TEMP DIRECTORY local_dir <- tempdir() # LOAD AND SAVE A GAME TO TEMP DIRECTORY save_raw_pbp(\"2021_20_BUF_KC\", dir = local_dir) #> # A tibble: 1 × 10 #> success status_code resumefrom url destfile error type modified #> #> 1 TRUE 200 0 https… /tmp/Rt… NA appl… NA #> # ℹ 2 more variables: time , headers # REMOVE THE DIRECTORY unlink(file.path(local_dir, 2021)) # }"},{"path":"https://www.nflfastr.com/reference/stat_ids.html","id":null,"dir":"Reference","previous_headings":"","what":"NFL Stat IDs and their Meanings — stat_ids","title":"NFL Stat IDs and their Meanings — stat_ids","text":"NFL Stat IDs Meanings","code":""},{"path":"https://www.nflfastr.com/reference/stat_ids.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"NFL Stat IDs and their Meanings — stat_ids","text":"","code":"stat_ids"},{"path":"https://www.nflfastr.com/reference/stat_ids.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"NFL Stat IDs and their Meanings — stat_ids","text":"data frame including NFL stat IDs, names descriptions used nflfastR dataset.","code":""},{"path":"https://www.nflfastr.com/reference/stat_ids.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"NFL Stat IDs and their Meanings — stat_ids","text":"http://www.nflgsis.com/gsis/Documentation/Partners/StatIDs.html","code":""},{"path":"https://www.nflfastr.com/reference/stat_ids.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"NFL Stat IDs and their Meanings — stat_ids","text":"","code":"# \\donttest{ stat_ids #> # A tibble: 112 × 3 #> stat_id name comment #> #> 1 1 Rushing Yards - Minus \"Used in addition to the other Rushing st… #> 2 2 Punt Blocked (Offense) \"Punt was blocked. A blocked punt is a pu… #> 3 3 1st Down Rushing \"A first down or TD occurred due to a rus… #> 4 4 1st Down Passing \"A first down or TD occurred due to a pas… #> 5 5 1st Down Penalty \"A first down or TD occurred due to a pen… #> 6 6 3rd Down Attempt Converted \"3rd down play resulted in a first down o… #> 7 7 3rd Down Attempt Failed \"3rd down play did NOT result in a first … #> 8 8 4th Down Attempt Converted \"4th down play resulted in a first down o… #> 9 9 4th Down Attempt Failed \"4th down play did NOT result in a first … #> 10 10 Rushing Yards \"Rushing yards and credit for a rushing a… #> # ℹ 102 more rows # }"},{"path":"https://www.nflfastr.com/reference/teams_colors_logos.html","id":null,"dir":"Reference","previous_headings":"","what":"NFL Team names, colors and logo urls. — teams_colors_logos","title":"NFL Team names, colors and logo urls. — teams_colors_logos","text":"NFL Team names, colors logo urls.","code":""},{"path":"https://www.nflfastr.com/reference/teams_colors_logos.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"NFL Team names, colors and logo urls. — teams_colors_logos","text":"","code":"teams_colors_logos"},{"path":"https://www.nflfastr.com/reference/teams_colors_logos.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"NFL Team names, colors and logo urls. — teams_colors_logos","text":"data frame 36 rows 10 variables containing NFL team level information, including franchises multiple cities: team_abbr Team abbreviation team_name Complete Team name team_id Team id used roster function team_nick Nickname team_conf Conference team_division Division team_color Primary color team_color2 Secondary color team_color3 Tertiary color team_color4 Quaternary color team_logo_wikipedia Url Team logo wikipedia team_logo_espn Url higher quality logo espn team_wordmark Url team wordmarks team_conference_logo Url AFC NFC logos team_league_logo Url NFL logo primary secondary colors taken nfl.com modifications better team distinction recent team color themes. tertiary quaternary colors taken Lee Sharpe's teamcolors.csv taken teamcolors package created Ben Baumer Gregory Matthews. Wikipeadia logo urls taken Lee Sharpe's logos.csv Team wordmarks nfl.com","code":""},{"path":"https://www.nflfastr.com/reference/teams_colors_logos.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"NFL Team names, colors and logo urls. — teams_colors_logos","text":"","code":"# \\donttest{ teams_colors_logos #> # A tibble: 36 × 15 #> team_abbr team_name team_id team_nick team_conf team_division team_color #> #> 1 ARI Arizona Cardi… 3800 Cardinals NFC NFC West #97233F #> 2 ATL Atlanta Falco… 0200 Falcons NFC NFC South #A71930 #> 3 BAL Baltimore Rav… 0325 Ravens AFC AFC North #241773 #> 4 BUF Buffalo Bills 0610 Bills AFC AFC East #00338D #> 5 CAR Carolina Pant… 0750 Panthers NFC NFC South #0085CA #> 6 CHI Chicago Bears 0810 Bears NFC NFC North #0B162A #> 7 CIN Cincinnati Be… 0920 Bengals AFC AFC North #FB4F14 #> 8 CLE Cleveland Bro… 1050 Browns AFC AFC North #FF3C00 #> 9 DAL Dallas Cowboys 1200 Cowboys NFC NFC East #002244 #> 10 DEN Denver Broncos 1400 Broncos AFC AFC West #002244 #> # ℹ 26 more rows #> # ℹ 8 more variables: team_color2 , team_color3 , team_color4 , #> # team_logo_wikipedia , team_logo_espn , team_wordmark , #> # team_conference_logo , team_league_logo # }"},{"path":"https://www.nflfastr.com/reference/update_db.html","id":null,"dir":"Reference","previous_headings":"","what":"Update or Create a nflfastR Play-by-Play Database — update_db","title":"Update or Create a nflfastR Play-by-Play Database — update_db","text":"update_db updates creates database nflfastR play play data completed games since 1999.","code":""},{"path":"https://www.nflfastr.com/reference/update_db.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Update or Create a nflfastR Play-by-Play Database — update_db","text":"","code":"update_db( dbdir = getOption(\"nflfastR.dbdirectory\", default = \".\"), dbname = \"pbp_db\", tblname = \"nflfastR_pbp\", force_rebuild = FALSE, db_connection = NULL )"},{"path":"https://www.nflfastr.com/reference/update_db.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Update or Create a nflfastR Play-by-Play Database — update_db","text":"dbdir Directory database shall located. Can also set globally options(nflfastR.dbdirectory) dbname File name existing desired SQLite database within dbdir tblname name play play data table within database force_rebuild Hybrid parameter (logical numeric) rebuild parts complete play play data table within database (please see details information) db_connection DBIConnection object, returned DBI::dbConnect() (please see details information)","code":""},{"path":"https://www.nflfastr.com/reference/update_db.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Update or Create a nflfastR Play-by-Play Database — update_db","text":"function creates updates data table name tblname within SQLite database (drivers via db_connection) located dbdir named dbname. data table combines play play data every available game back 1999 season adds recent completed games soon available nflfastR. argument force_rebuild hybrid type. can rebuild play play data table either whole nflfastR era (force_rebuild = TRUE) just specified seasons (e.g. force_rebuild = c(2019, 2020)). Please note following behavior: force_rebuild = TRUE: data table name tblname removed completely rebuilt scratch. helpful new columns added -Season. force_rebuild = c(2019, 2020): data table name tblname preserved rows 2019 2020 seasons deleted re-added. intended used ongoing seasons NFL fixes bugs underlying data week recommend rebuilding current season every Thursday season. parameter db_connection intended advanced users want use DBI drivers, MariaDB, Postgres odbc. Please note arguments dbdir dbname dropped case db_connection provided argument tblname still used write data table database.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-development-version","dir":"Changelog","previous_headings":"","what":"nflfastR (development version)","title":"nflfastR (development version)","text":"Drop crayon, DT, httr, jsonlite, qs dependencies. (#453) function calculate_player_stats_def now returns season_type argument weekly set TRUE consistency player stats functions. (#455) function missing_raw_pbp() now allows filtering season. (#457) robust handling player IDs decode_player_ids(). (#458) Fixed rare cases value yrdln variable didn’t equal \"MID 50\" midfield. (#459) Fixed rare cases drive_start_yard_line missed blank space team name yard line number. (#459) Fixed play description 1999 2000 games string “D.Holland” replaced kick distance. (#459) Fixed problem goal_to_go variable FALSE actual goal go situations. (#460) Fixed bug fixed_drive fixed_drive_result second weather delay 2023_13_ARI_PIT wasn’t identified correctly. (#461)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-461","dir":"Changelog","previous_headings":"","what":"nflfastR 4.6.1","title":"nflfastR 4.6.1","text":"CRAN release: 2024-01-09 function calculate_series_conversion_rates() now correctly aggregates season level conversion rates. Performance also improved. (#440) Adjusted test behavior CRAN’s request. Thank @andrewtek, @gregalvi86, @Ic4ru5Wing, @JoeMarino2021, @jreddy1990, @marvin3FF, @mrcaseb, @RicShern, @SPNE, @trivialfis questions, feedback, contributions towards release.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-460","dir":"Changelog","previous_headings":"","what":"nflfastR 4.6.0","title":"nflfastR 4.6.0","text":"CRAN release: 2023-10-20","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-features-4-6-0","dir":"Changelog","previous_headings":"","what":"New Features","title":"nflfastR 4.6.0","text":"nflfastR now fully supports loading raw pbp data local file system. best way use feature set options(\"nflfastR.raw_directory\" = {\"/local/directory\"}). Alternatively, build_nflfastR_pbp() fast_scraper() support argument dir defaults option. (#423) Added new function save_raw_pbp() efficiently downloads raw play--play data saves local file system. serves helper setup system faster play--play parsing via functionality. (#423) Added new function missing_raw_pbp() computes vector game IDs missing local raw play--play directory. (#423)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-bugfixes-4-6-0","dir":"Changelog","previous_headings":"","what":"Minor Improvements and Bugfixes","title":"nflfastR 4.6.0","text":"internal function get_pbp_nfl() now uses ifelse() instead dplyr::if_else() handle null-checking, fixes bug found 2022_21_CIN_KC match. function calculate_player_stats() now summarises target share air yards share correctly called argument weekly = FALSE (#413) function calculate_player_stats() now returns opponent team called argument weekly = TRUE (#414) function calculate_player_stats_def() longer errors small subsets pbp data missing stats. (#415) function calculate_series_conversion_rates() longer returns NA values small subset pbp data missing series offense defense. (#417) fixed_drive now correctly increments plays posteam lost fumble remains posteam defteam also lost fumble play. (#419) nflfastR now fixes missing drive number counts raw pbp data order provide accurate drive information. (#420) nflfastR now returns correct kick_distance punts kickoffs. (#422) Decode player IDs 2023 pbp. (#425) Drop pseudo plays TV Timeout Two-Minute Warning. (#426) Fix posteam kickoffs PATs following defensive TD 2023+ pbp. (#427) calculate_player_stats() counts lost fumbles plays player fumbles, team mate recovers loses fumble defense. (#431) variables passer, receiver, rusher return NA “abnormal” plays - like direct snaps, aborted snaps, laterals etc. - resulted penalty. (#435) Thank @903124, @ak47twq, @andrewtek, @darkhark, @dennisbrookner, @marvin3FF, @mistakia, @mrcaseb, @nicholasmendoza22, @rickstarblazer, @RileyJohnson22, @tanho63 questions, feedback, contributions towards release.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-451","dir":"Changelog","previous_headings":"","what":"nflfastR 4.5.1","title":"nflfastR 4.5.1","text":"CRAN release: 2022-12-22 New implementation tests able identify breaking changes reverse dependencies (#396, #406) calculate_standings() freezes computing standings schedules games missing results, .e. upcoming games. Bug fix caused problems upcoming dplyr tidyselect updates weren’t reverse compatible. Significant performance improvements internal functions. (#402) Wrap examples try() avoid CRAN problems. (#404) Fixed bug calculate_standings() wasn’t able handle nflverse pbp data. (#404)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-450","dir":"Changelog","previous_headings":"","what":"nflfastR 4.5.0","title":"nflfastR 4.5.0","text":"CRAN release: 2022-11-05","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-experimental-functions-4-5-0","dir":"Changelog","previous_headings":"","what":"New (experimental) functions","title":"nflfastR 4.5.0","text":"Added new function calculate_player_stats_def() aggregates defensive player stats either game level overall. (#288) situation report nflverse_sitrep alias already available report() Added new function calculate_player_stats_kicking() aggregates player stats field goals extra points game level overall. (#381) Added new function calculate_series_conversion_rates() computes series conversion series result rates game level season level. (#393)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"bugfixes-and-minor-improvements-4-5-0","dir":"Changelog","previous_headings":"","what":"Bugfixes and Minor Improvements","title":"nflfastR 4.5.0","text":"Internal change calculate_player_stats() reflects new nflverse data infrastructure. player_display_name - Full name player position - Position player position_group - Position group player headshot_url - URL player headshot image Make data work 2022 (hopefully) Fix Amon-Ra St. Brown breaking name parser Add gsis_id patch clean_pbp(). calculate_player_stats_def() failed situations play--play data missing certain stats. (#382) Spot-fixing calculate_player_stats() NA names.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-440","dir":"Changelog","previous_headings":"","what":"nflfastR 4.4.0","title":"nflfastR 4.4.0","text":"CRAN release: 2022-08-06","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-functions-options-data-4-4-0","dir":"Changelog","previous_headings":"","what":"New Functions, Options, Data","title":"nflfastR 4.4.0","text":"Added new function calculate_standings() computes regular season division standings playoff seeds nflverse data. database function update_db() now supports option “nflfastR.dbdirectory” can used set directory nflfastR pbp database globally independent project structure working directories. embedded data frame ?teams_colors_logos updated reflect recent team color themes gained additional variables conference division well logo urls conference league logos. (#290) embedded data frame ?teams_colors_logos updated Washington Commanders. (#312)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"deprecation-4-4-0","dir":"Changelog","previous_headings":"","what":"Deprecation","title":"nflfastR 4.4.0","text":"argument qs functions load_pbp() load_player_stats() deprecated nflfastR 4.3.0. release removes argument entirely.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"bugfixes-and-minor-improvements-4-4-0","dir":"Changelog","previous_headings":"","what":"Bugfixes and Minor Improvements","title":"nflfastR 4.4.0","text":"Fixed bug player duplicated calculate_player_stats() rare cases caused plays laterals. (#289) Fixed bug function add_xpass() failed called empty data frame. (#296) Fixed bug play_type showed no_play plays penalties don’t result replay . (#277, #281) Fixed bug variable descriptions total_home_score total_away_score. (#300) fast_scraper_rosters() fast_scraper_schedules() now call nflreadr::load_rosters() nflreadr::load_schedules() hood (#304) Fixed bug causing missing EPA game-ending turnovers overtime Bump minimum nflreadr version 1.2.0 data repository change Fix bug affecting yardline small number plays 2000 season (#323) update_db() now uses default play predefine column types db drivers. (#324) Fix bug resulted incorrect xyac_mean_yardage 4th downs (#327) Fix bug resulted missing xyac information plays involving J.O’Shaughnessy (#329) Fix bug resulted missing epa last play games involving NE BUF (#331) fast_scraper() build_nflfastR_pbp() now return data frames class nflverse_data consistent nflreadr. Fix behavior EP model neutral site games (treats teams away teams)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-430","dir":"Changelog","previous_headings":"","what":"nflfastR 4.3.0","title":"nflfastR 4.3.0","text":"CRAN release: 2021-10-06","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-changes-4-3-0","dir":"Changelog","previous_headings":"","what":"Minor Changes","title":"nflfastR 4.3.0","text":"Add nflreadr dependecies drop lubridate magrittr dependency functions load_pbp() load_player_stats() now call nflreadr::load_pbp() nflreadr::load_player_stats() respectively. Therefore argument qs deprecated functions. removed future release. Running load_player_stats() without argument now return player stats current season (default nflreadr). deprecated arguments source pp functions fast_scraper_*() build_nflfastR_pbp() removed Added variables racr (“Receiver Air Conversion Ratio”), target_share, air_yards_share, wopr (“Weighted Opportunity Rating”) pacr (“Passing Air Conversion Ratio”) output calculate_player_stats() Added function report() used maintainers help users debug problems (#274).","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"bug-fixes-4-3-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"nflfastR 4.3.0","text":"Fixed minor bug console output update_db() Fix handful missing receiver names (#270) Fixed bug missing return_team interception return touchdowns (#275) Fixed rare bug internal object wasn’t predefined (#272)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-420","dir":"Changelog","previous_headings":"","what":"nflfastR 4.2.0","title":"nflfastR 4.2.0","text":"CRAN release: 2021-08-03 wpa variables NA end game line wp variables 0, 0.5, 1, NA end game line Fix bug win prob PATs assumed PAT placed 15 yard line, even older seasons function decode_player_ids() now really decodes new variable fantasy_id (#229) Fixed bug caused slightly differing wp values depending first game data set (#183) Edited GitHub references point nflverse Added variables sack_yards, sack_fumbles, rushing_fumbles receiving_fumbles output function calculate_player_stats(), thanks Mike Filicicchia (@TheMathNinja). (#239) Fixed bug calculate_player_stats() falsely counted lost fumbles aborted snaps (#238) Added variable season_type output calculate_player_stats() load_player_stats() preparation extended Regular Season starting 2021 (#240) Updated season_type definitions preparation extended Regular Season starting 2021 (#242) Fix fixed_drive wasn’t incrementing muffed punt followed timeout (#244) Fix fixed_drive wasn’t incrementing following interception intercepting player losing fumble (#247) Fix issues missing play info 2018_01_ATL_PHI (#246) Added variables safety_player_name safety_player_id play--play data (#252) Dropped dependency usethis","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-410","dir":"Changelog","previous_headings":"","what":"nflfastR 4.1.0","title":"nflfastR 4.1.0","text":"CRAN release: 2021-03-23","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"functions-4-1-0","dir":"Changelog","previous_headings":"Breaking changes","what":"Functions","title":"nflfastR 4.1.0","text":"Added function calculate_player_stats() aggregates official passing, rushing, receiving stats either game level overall Added function load_player_stats() loads weekly player stats 1999 recent season performance functions add_xyac() clean_pbp() significantly improved","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-variables-4-1-0","dir":"Changelog","previous_headings":"Breaking changes","what":"New Variables","title":"nflfastR 4.1.0","text":"Added new columns td_player_name td_player_id clearly identify player scored touchdown (especially helpful plays multiple fumbles laterals resulting touchdown) function calculate_player_stats() now adds variable dakota, epa + cpoe composite, players minimum 5 pass attempts. Added column home_opening_kickoff clean_pbp() Added variables sack_player_id, sack_player_name, half_sack_1_player_id, half_sack_1_player_name, half_sack_2_player_id half_sack_2_player_name identify players recorded sacks (half sacks). Also updated description variables qb_hit_1_player_id, qb_hit_1_player_name, qb_hit_2_player_id qb_hit_2_player_name make clear record sack. (#180)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-fixes-4-1-0","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"nflfastR 4.1.0","text":"variable qb_scramble incomplete 2005 season missing scramble indicators play description. mostly fixed courtesy charting data Football Outsiders (thanks Aaron Schatz!). notes fix: Weeks 1-16 based charting. Weeks 17-21 guesses (basically every QB run except ) loss, b) gain, c) 3/4 1-2 go). Plays nullified penalty included. Change name, id, rusher, rusher_id player charged fumble aborted snaps QB unable make play (.e. pass, sack, scramble) (#162) function clean_pbp() now standardizes team name columns tackle_with_assist_*_team Fix bug drive causing incorrect overtime win probabilities (#194) Fixed bug posteam NA end quarter 2 (end quarter 4 overtime games) causing wrong values fixed_drive, fixed_drive_result, series series_result Fixed bug fixed_drive series falsely incrementing kickoffs recovered kicking team defensive touchdowns followed timeouts Fixed bug fixed_drive series falsely incrementing muffed punts recovered punting team touchdown Fixed bug add_xpass() crashed ran data already including xpass variables. Fixed bug epa safety scored team beginning play possession ball (#186) Fix bugs related David Duke Johnson Texans 2020 (#163) Fix yet another bug related correctly identifying possession team kickoffs nullified penalty (#199) Fixed bug calculate_player_stats() forgot clean player names using IDs Fixed bug special teams touchdowns missing output calculate_player_stats() (#203) Fixed old Jaguars games wrong team awarded points safeties kickoff return TDs (#209) function update_db() falsely closes database connection provided argument db_connection (#210) Fixed bug yards_gained missing yardage plays laterals. (#216) Fixed bug stats wrongly given play penalty (#218) fixed_drive now increments properly onside kick recoveries (#215) fixed_drive longer counts muffed kickoff one-play drive (#217) fixed_drive now properly increments safety (#219) Improved parser penalty_type updated description variable make clear ’s first penalty happened play. (#223)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-400","dir":"Changelog","previous_headings":"","what":"nflfastR 4.0.0","title":"nflfastR 4.0.0","text":"CRAN release: 2021-02-15","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"changed-functions-4-0-0","dir":"Changelog","previous_headings":"Breaking changes","what":"Changed Functions","title":"nflfastR 4.0.0","text":"Deprecated arguments source pp across package. Using cause warning. Parallel processing activated choosing appropriate future::plan() calling relevant functions. information please see package documentation. function build_nflfastR_pbp() now run decode_player_ids() default (can deactivated argument decode = FALSE). function build_nflfastR_pbp() now run add_xpass() default add new variables xpass pass_oe. functions fast_scraper() build_nflfastR_pbp() now allow output fast_scraper_schedules() directly input ’s necessary anymore pull game_id first.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-functions-and-variables-4-0-0","dir":"Changelog","previous_headings":"Breaking changes","what":"New Functions and Variables","title":"nflfastR 4.0.0","text":"Added new function load_pbp() loads complete seasons memory fast access play--play data. Added new variables rushing_yards, lateral_rushing_yards, passing_yards, receiving_yards, lateral_receiving_yards fix old bug yards_gained gets overwritten plays laterals (#115). Added columns vegas_wpa vegas_home_wpa contain Win Probability Added spread-adjusted WP model Added column out_of_bounds Added columns fantasy, fantasy_id, fantasy_player_name, fantasy_player_id indicate rusher receiver play Added columns tackle_with_assist, tackle_with_assist_1_player_id, tackle_with_assist_1_player_name, tackle_with_assist_1_team, tackle_with_assist_2_player_id, tackle_with_assist_2_player_name, tackle_with_assist_2_team","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"models-and-miscellaneous-4-0-0","dir":"Changelog","previous_headings":"Breaking changes","what":"Models and Miscellaneous","title":"nflfastR 4.0.0","text":"Tuned spread-adjusted win probability model one final (?) time. Expected points now longer required calculate_win_probability() Added field descriptions vignette(\"field_descriptions\") searchable list nflfastR variables Switched data source 2001-2010 used 2011 models moved fastrmodels package Added data frames ?field_descriptions ?stat_ids package","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-fixes-4-0-0","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"nflfastR 4.0.0","text":"Fix bug fixed_drive series weren’t updating muffed punt (#144) Fix bug induced fixing (#149) Fix bug special teams plays incorrectly labeled pass plays (#125) Fix bug points safeties given defteam instead posteam (#152) Fix bug muffed punt TD given wrong team 2011 Jaguars game (#154) Win probability now calculated prior PAT attempts rather using WP ensuing kickoff Improved performance internal functions speed rebuilding process update_db() (added qs curl dependencies) Fixed bug calculate_expected_points() calculate_win_probability() duplicated existing variables instead replacing (#170) Fixed bug penalty_type wasn’t \"no_play\" although (#172) Fixed bug penalty_team incorrect games Jaguars seasons 2011 - 2015 (#174) Fixed bug related calculation epa plays failed pass interference challenge 2019 games (#175) Fixed bug related lots fields NA offsetting penalties (#44) Fixed bug epa possession team changes end 1st 3rd quarter (#182) Fixed bug various functions left open connections vegas_wp now NA final line since possession team","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-320","dir":"Changelog","previous_headings":"","what":"nflfastR 3.2.0","title":"nflfastR 3.2.0","text":"CRAN release: 2020-11-20","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"models-3-2-0","dir":"Changelog","previous_headings":"","what":"Models","title":"nflfastR 3.2.0","text":"Performance update win probability model point spread (vegas_wp) Added yardline_100 input win probability models (included oversight)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-fixes-3-2-0","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"nflfastR 3.2.0","text":"Fixed bug series increased PATs Fixed bug affecting week 10 Raiders-Broncos game Added column team_wordmark - contains URLs team’s wordmarks - included data frame ?teams_colors_logos","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-311","dir":"Changelog","previous_headings":"","what":"nflfastR 3.1.1","title":"nflfastR 3.1.1","text":"CRAN release: 2020-10-22","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"database-function-update_db-3-1-1","dir":"Changelog","previous_headings":"New features","what":"Database Function update_db()","title":"nflfastR 3.1.1","text":"argument force_rebuild function update_db() now hybrid type. can rebuild play play data table either whole nflfastR era (force_rebuild = TRUE) just specified seasons (e.g. force_rebuild = 2019:2020). latter intended used running seasons NFL fixes bugs play play data week recommend rebuild current season every Thursday. Fixed bug update_db() disconnected connection database provided argument db_connection (#102) Fixed bug update_db() didn’t build fresh database without providing argument force_rebuild update_db() longer removes complete data table numeric argument force_rebuild passed removes rows within table (#109)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-functions-3-1-1","dir":"Changelog","previous_headings":"New features","what":"New Functions","title":"nflfastR 3.1.1","text":"Added new function build_nflfastR_pbp(), convenient wrapper around multiple nflfastR functions easy creation nflfastR play--play data set Added function applies experimental expected pass model, add_xpass(), creates columns xpass pass_oe","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-fixes-3-1-1","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"nflfastR 3.1.1","text":"fixes fixed_drive incrementing properly drives began following timeout Fixed bugs EPA win probability PATs kickoffs penalties Fixed bug scoring probabilities weren’t adding 1 field goal attempts near end half Messages user now created new dependency usethis Fixed bug plays “backward pass” play description counted pass plays (pass = 1) Fixed missing kick distance touchbacks blocked punts (#53) Added option fast (either TRUE FALSE) function decode_player_ids() activate high efficient C++ decoder package gsisdecoder","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-300","dir":"Changelog","previous_headings":"","what":"nflfastR 3.0.0","title":"nflfastR 3.0.0","text":"CRAN release: 2020-09-24","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"breaking-changes-3-0-0","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"nflfastR 3.0.0","text":"fast_scraper_roster() finally back! loads NFL roster given season. Added function decode_player_ids() decode player IDs commonly known GSIS ID format (00-00xxxxx)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"new-features-3-0-0","dir":"Changelog","previous_headings":"","what":"New features","title":"nflfastR 3.0.0","text":"Add option source = \"old\" fast_scraper() enable scraping old source. mostly useless doesn’t work 2020 provides less info Added new option db_connection update_db() allow advanced users use DBI drivers, RMariaDB::MariaDB(), RPostgres::Postgres() odbc::odbc() (please see dbplyr information)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"minor-improvements-and-fixes-3-0-0","dir":"Changelog","previous_headings":"","what":"Minor improvements and fixes","title":"nflfastR 3.0.0","text":"clean_pbp() now fixes bugs jersey numbers clean_pbp(), add_qb_epa() add_xyac() can now handle empty data frames Fix empty line causing fast_scraper() fail (affects multiple games 2020 season) Fix bug fixed_drive counted PAT defensive TD drive Fixed bug caused high number tackles special cases Fixed bug CPOE NA targeting players apostrophe last name","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-221","dir":"Changelog","previous_headings":"","what":"nflfastR 2.2.1","title":"nflfastR 2.2.1","text":"CRAN release: 2020-09-01 Fix add_xyac() breaking old packages Fix add_xyac() add_qb_epa() calculations wrong failed 4th downs Updated Readme ep cp model plots Updated vignette(\"examples\") new add_xyac() function Added xYAC model vignette(\"nflfastR-models\") Added variables fixed_drive fixed_drive_result output fast_scraper() NFL-provided drive info extremely buggy Added variable series_result clean_pbp() now adds 4 new variables passer_jersey_number, rusher_jersey_number, receiver_jersey_number jersey_number. can used join rosters. Fixed incorrect timeout_team, return_team, fumble_recovery_1_team JAX games 2011-2015 Re-trained EPA model fixed_drive corrections timeout_team","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-220","dir":"Changelog","previous_headings":"","what":"nflfastR 2.2.0","title":"nflfastR 2.2.0","text":"New function add_xyac() adds following columns associated expected yards catch (xYAC): xyac_epa, xyac_success, xyac_fd, xyac_mean_yardage, xyac_median_yardage","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-213","dir":"Changelog","previous_headings":"","what":"nflfastR 2.1.3","title":"nflfastR 2.1.3","text":"Fixed bug series_success caused bad drive information provided NFL","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-212","dir":"Changelog","previous_headings":"","what":"nflfastR 2.1.2","title":"nflfastR 2.1.2","text":"Added following columns available 2011 later: special_teams_play, st_play_type, time_of_day, order_sequence Added old_game_id column (useful merging external data still uses ID: format YYYYMMDDxx) clean_pbp() function now adds aborted_play column Fixed bug pass plays penalty end play classified play_type = no_play rather pass Fixed bug EPA defensive 2 point return -0.95 instead -2.95 Fixed remaining failed challenge plays incorrectly 0 EPA Updated included dataframe teams_colors_logos interim name ‘Washington Football Team’ corresponding logo urls. internal code improvements causing required tidyselect version >= 1.1.0","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"functions-2-1-1","dir":"Changelog","previous_headings":"","what":"Functions","title":"nflfastR 2.1.1","text":"players whose careers finished 2011, IDs remain players played eras new era, ID new ID example, Akili Smith (ID: 00-0015082) Alex Smith (ID: 32013030-2d30-3032-3334-3336b638d37d) abbreviated “.Smith” can distinguished IDs, Akili showing old format ID looks like, Smith new one Standardization realized using ID map available data repo clean_pbp() now removes variables create make sure nothing unexpected can happen","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"miscellaneous-2-1-1","dir":"Changelog","previous_headings":"","what":"Miscellaneous","title":"nflfastR 2.1.1","text":"Added minimum version requirements package dependencies installation broke users outdated packages Made minor bug fix catch --order plays fixed bug plays incorrectly dropped older seasons Standardized team names (e.g. SD –> LAC) columns missed","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"models-2-1-0","dir":"Changelog","previous_headings":"","what":"Models","title":"nflfastR 2.1.0","text":"Removed week Expected Points models along update vignette(\"nflfastR-models\") vignette(\"examples\")","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"functions-2-1-0","dir":"Changelog","previous_headings":"","what":"Functions","title":"nflfastR 2.1.0","text":"Added function update_db() adds completed games SQLite database Added function calculate_win_probability() Added new examples vignette(\"examples\") demonstrating usage mentioned functions","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"bugs-2-1-0","dir":"Changelog","previous_headings":"","what":"Bugs","title":"nflfastR 2.1.0","text":"Fixed problem inconsistent data types variable drive_real_start_time pre post 2011 Fixed problem game_ids overwritten play play parsing Fix WP bugs kickoffs penalties rare play description","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"miscellaneous-2-1-0","dir":"Changelog","previous_headings":"","what":"Miscellaneous","title":"nflfastR 2.1.0","text":"fast_scraper() now loads raw game data separate raw data repo Completely overhauled entire code base directly implement tidy evaluation using .data rlang package (major code change takes getting used need preparation future release)","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-206","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.6","title":"nflfastR 2.0.6","text":"Fixed problem defensive two point conversions counted Kneels kickoffs longer counted qb kneels Variable yards_gained precisely defined Bugfixes games order plays Fix bug related EPA plays failed pass interference challenge Added new example vignette(\"examples\") demonstrate Expected Points calculator calculate_expected_points() Fix WP 2-pt conversion negated penalty Add variables (containing team names) team standardization clean_pbp() Fix WP onside kicks","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-205","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.5","title":"nflfastR 2.0.5","text":"Fix yet another bug caused NFL providing plays order Fix bugs related penalties PATs kickoffs Fix bugs related NFL providing wrong scoring team defensive touchdowns older games involving Jaguars Fix minor issues related wrong first_down_rush return_touchdown Improved error handling fast_scraper() yet played games Improved variable documentation prepared new website Improved performance dplyr v1.0.0 Rebuilt EP WP models due bugfixes underlying data versions 2.0.3, 2.0.4 2.0.5","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-204","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.4","title":"nflfastR 2.0.4","text":"Fix another bug order plays Fix bug affecting cumulative totals WPA, air_WPA yac_WPA Fix bug affecting cumulative totals air_EPA yac_EPA","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-203","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.3","title":"nflfastR 2.0.3","text":"Fix NFL providing plays order Fix series incrementing following defensive TD","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-202","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.2","title":"nflfastR 2.0.2","text":"Fixed bug series series success calculations caused timeouts following possession change Fixed win probability PATs","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"nflfastr-201","dir":"Changelog","previous_headings":"","what":"nflfastR 2.0.1","title":"nflfastR 2.0.1","text":"Added minimum version requirement xgboost (>= 1.1) recent xgboost update caused breaking change leading failure adding model results data","code":""},{"path":[]},{"path":"https://www.nflfastr.com/news/index.html","id":"models-2-0-0","dir":"Changelog","previous_headings":"","what":"Models","title":"nflfastR 2.0.0","text":"Added new models Expected Points, Win Probability Completion Probability removed nflscrapR dependency. major change stepping away well established nflscrapR models. believe good step forward. See data-raw/MODEL-README.md detailed model information. Added internal functions EPA WPA helper_add_ep_wp.R. Added new function calculate_expected_points() usable enduser.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"functions-2-0-0","dir":"Changelog","previous_headings":"","what":"Functions","title":"nflfastR 2.0.0","text":"Completely overhauled fast_scraper() make work NFL’s new server backend. option source still available deprecated since one source now. changes output well (please see ). fast_scraper() now adds game data play play data set courtesy Lee Sharpe. Game data include: away_score, home_score, location, result, total, spread_line, total_line, div_game, roof, surface, temp, wind, home_coach, away_coach, stadium, stadium_id, gameday fastcraper_schedules() now incorporates Lee Sharpe’s games.rds. functions fast_scraper_clips() fast_scraper_roster() deactivated due missing data source. might reactivated completely dropped future versions. function fix_fumbles() renamed add_qb_epa() new name much better describes function actually .","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"miscellaneous-2-0-0","dir":"Changelog","previous_headings":"","what":"Miscellaneous","title":"nflfastR 2.0.0","text":"Added progress information using progressrpackage removed furrr progress bars. clean_pbp() now adds column ìd id player column name. piece together different data cover full span years, player IDs consistent early (1999-2010) recent (2011 onward) periods. Added NEWS.md file track changes package. Fixed several bugs inhereted nflscrapR, including one EPA missing play followed two timeouts (example, two-minute warning followed timeout), another play_type incorrect plays declined penalties. Fixed bug, receiver_player_name receiver didn’t name correct players plays lateral passes.","code":""},{"path":"https://www.nflfastr.com/news/index.html","id":"play-by-play-output-2-0-0","dir":"Changelog","previous_headings":"","what":"Play-by-Play Output","title":"nflfastR 2.0.0","text":"output changed little bit.","code":""},{"path":[]},{"path":[]},{"path":[]}]