calculate_stats: Calculate NFL Stats

View source: R/calculate_stats.R

calculate_statsR Documentation

Calculate NFL Stats

Description

Compute various NFL stats based off nflverse Play-by-Play data.

Usage

calculate_stats(
  seasons = nflreadr::most_recent_season(),
  summary_level = c("season", "week"),
  stat_type = c("player", "team"),
  season_type = c("REG", "POST", "REG+POST")
)

Arguments

seasons

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

summary_level

Summarize stats by "season" or "week".

stat_type

Calculate "player" level stats or "team" level stats.

season_type

One of "REG", "POST", or "REG+POST". Filters data to regular season ("REG"), post season ("POST") or keeps all data. Only applied if summary_level == "season".

Value

A tibble of player/team stats summarized by season/week.

See Also

nfl_stats_variables for a description of all variables.

https://www.nflfastr.com/articles/stats_variables.html for a searchable table of the stats variable descriptions.

Examples


try({# to avoid CRAN test problems
stats <- calculate_stats(2023, "season", "player")
dplyr::glimpse(stats)
})


mrcaseb/nflfastR documentation built on April 14, 2025, 12:14 a.m.