Skip to content

Commit

Permalink
Added playerstats_def dictionary (#192)
Browse files Browse the repository at this point in the history
* Added playerstats_def dictionary

* version and news bullet

* export dictionary and redocument

* add vignette

* avoid cross ref warning

---------

Co-authored-by: Sebastian Carl <[email protected]>
  • Loading branch information
mpcen and mrcaseb authored Aug 7, 2023
1 parent 7cfab5c commit 487c1a2
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: nflreadr
Title: Download 'nflverse' Data
Version: 1.3.2.05
Version: 1.3.2.06
Authors@R: c(
person("Tan", "Ho", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-8388-5155")),
Expand Down Expand Up @@ -48,4 +48,4 @@ Config/testthat/edition: 3
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ a moving target 🙃 (1.3.2.01)
etc falsely returned last season after March 15th early in the month. (1.3.2.03)
- Clarified description of the `"special"` variable in the play-by-play data dictionary. (1.3.2.04) (#189)
- `nflreadr::nflverse_game_id()` accepts old team abbreviations and outputs useful errors. (1.3.2.05) (#191)
- Added `dictionary_player_stats_def` (thank you @mpcen!) (1.3.2.06) (#192)

# nflreadr 1.3.2

Expand Down
8 changes: 8 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
#' @seealso <https://nflreadr.nflverse.com/articles/dictionary_player_stats.html>
"dictionary_player_stats"

#' Data Dictionary: Player Stats Defense
#'
#' A dataframe containing the data dictionary for [`load_player_stats()`]
#'
#' @seealso `vignette("Data Dictionary - Player Stats Defense")`
#' @seealso <https://nflreadr.nflverse.com/articles/dictionary_player_stats_def.html>
"dictionary_player_stats_def"

#' Data Dictionary: Fantasy Player IDs
#'
#' A dataframe containing the data dictionary for [`load_ff_playerids()`]
Expand Down
4 changes: 4 additions & 0 deletions data-raw/build_data_dictionaries.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ dictionary_player_stats <- read.csv("data-raw/dictionary_playerstats.csv") |>
dplyr::mutate_all(stringr::str_squish)
usethis::use_data(dictionary_player_stats, overwrite = TRUE)

dictionary_player_stats_def <- read.csv("data-raw/dictionary_playerstats_def.csv") |>
dplyr::mutate_all(stringr::str_squish)
usethis::use_data(dictionary_player_stats_def, overwrite = TRUE)

dictionary_ff_playerids <- read.csv("data-raw/dictionary_ff_playerids.csv") |>
dplyr::mutate_all(stringr::str_squish)
usethis::use_data(dictionary_ff_playerids, overwrite = TRUE)
Expand Down
23 changes: 23 additions & 0 deletions data-raw/dictionary_playerstats_def.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
field,data_type,description
def_tackles,numeric,Total number of tackles for this player
def_tackles_solo,numeric,Total number of solo tackles for this player
def_tackles_with_assist,numeric,Number of tackles this player had with an assisted tackle
def_tackle_assists,numeric,Number of assisted tackles for this player
def_tackles_for_loss,numeric,Number of tackles for loss (TFL) for this player
def_tackles_for_loss_yards,numeric,Yards lost from TFLs involving this player
def_fumbles_forced,numeric,Number of times a fumble was forced from this player
def_sacks,numeric,Number of sacks form this player
def_sack_yards,numeric,Yards lost from sacks forced by this player
def_qb_hits,numeric,Number of QB hits from this player (should not include plays where the QB was sacked)
def_interceptions,numeric,Number of interceptions forced by this player
def_interception_yards,numeric,yards gained/lost by interception returns from this player
def_pass_defended,numeric,Number of passes defended/broken up by this player
def_tds,numeric,Number of defensive touchdowns scored by this player
def_fumbles,numeric,Number of fumbles by this player
def_fumble_recovery_own,numeric,Number of times a player's team fumbled the ball and this player recovered
def_fumble_recovery_yards_own,numeric,Number of yards gained/lost from fumble recoveries that happened because the player's team fumbled the ball and this player recovered the fumble on that same play
def_fumble_recovery_opp,numeric,Number of times a player's opponent fumbled the ball and this player recovered
def_fumble_recovery_yards_opp,numeric,Number of yards gained/lost from fumble recoveries that happened because the player's opponent fumbled the ball and this player recovered the fumble on that same play
def_safety,numeric,Number of times this player forced a defensive safety
def_penalty,numeric,Number of times this player was penalized defensively
def_penalty_yards,numeric,Number of penalty yards for this player defensively
Binary file added data/dictionary_player_stats_def.rda
Binary file not shown.
3 changes: 1 addition & 2 deletions man/csv_from_url.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions man/dictionary_player_stats_def.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions vignettes/dictionary_player_stats_def.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "Data Dictionary - Player Stats Defense"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Data Dictionary - Player Stats Defense}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
echo = FALSE,
comment = "#>"
)
use_dt <- FALSE
if(requireNamespace("DT", quietly = TRUE)) use_dt <- TRUE
```

```{r eval = use_dt}
DT::datatable(nflreadr::dictionary_player_stats_def,
options = list(scrollX = TRUE, pageLength = 25),
filter = "top",
rownames = FALSE
)
```

```{r eval = !use_dt}
knitr::kable(nflreadr::dictionary_player_stats_def)
```

0 comments on commit 487c1a2

Please sign in to comment.