
Get Official Game Stats on Defense
Source:R/aggregate_game_stats_def.R
calculate_player_stats_def.RdThis function was deprecated because we have a new, much better and
harmonized approach in calculate_stats().
Build columns that aggregate official defense stats either at the game level or at the level of the entire data frame passed.
Arguments
- pbp
A Data frame of NFL play-by-play data typically loaded with
load_pbp()orbuild_nflfastR_pbp(). If the data doesn't include the variableqb_epa, the functionadd_qb_epa()will be called to add it.- weekly
If
TRUE, returns week-by-week stats, otherwise, stats for the entire Data frame.
See also
The function load_player_stats() and the corresponding examples
on the nflfastR website
Examples
# \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)
})
#> NULL
# }