compute_division_ranks {nflseedR} | R Documentation |
Compute NFL Division Rankings using Game Results
Description
Compute NFL Division Rankings using Game Results
Usage
compute_division_ranks(
games,
teams = NULL,
tiebreaker_depth = 3,
.debug = FALSE,
h2h = NULL
)
Arguments
games |
A data frame containing real or simulated game scores. The
following variables are required:
- sim
A simulation ID. Normally 1 - n simulated seasons.
- game_type
One of 'REG', 'WC', 'DIV', 'CON', 'SB' indicating if a game was a regular season game or one of the playoff rounds.
- week
The week of the corresponding NFL season.
- away_team
Team abbreviation of the away team (please see
divisions for valid team abbreviations).
- home_team
Team abbreviation of the home team (please see
divisions for valid team abbreviations).
- result
Equals home score - away score.
|
teams |
This parameter is optional. If it is NULL the function
will compute it internally, otherwise it has to be a data frame of all teams
contained in the games data frame repeated for each simulation ID
(sim ). The following variables are required:
- sim
A simulation ID. Normally 1 - n simulated seasons.
- team
Team abbreviation of the team (please see
divisions for valid team abbreviations).
- conf
Conference abbreviation of the team (please see
divisions for valid team abbreviations).
- division
Division of the team (please see
divisions for valid division names).
|
tiebreaker_depth |
A single value equal to 1, 2, or 3. The default is 3. The
value controls the depth of tiebreakers that shall be applied. The deepest
currently implemented tiebreaker is strength of schedule. The following
values are valid:
- tiebreaker_depth = 1
Break all ties with a coinflip. Fastest variant.
- tiebreaker_depth = 2
Apply head-to-head and division win percentage tiebreakers. Random if still tied.
- tiebreaker_depth = 3
Apply all tiebreakers through strength of schedule. Random if still tied.
|
.debug |
Either TRUE or FALSE . Controls whether additional
messages are printed to the console showing what the tie-breaking algorithms
are currently performing.
|
h2h |
A data frame that is used for head-to-head tiebreakers across the
tie-breaking functions. It is computed by the function
compute_division_ranks .
|
Value
A list of two data frames:
- standings
Division standings.
- h2h
A data frame that is used for head-to-head tiebreakers across the
tie-breaking functions.
See Also
The examples on the package website
Examples
# Change some options for better output
old <- options(list(digits = 3, tibble.print_min = 64))
library(dplyr, warn.conflicts = FALSE)
try({#to avoid CRAN test problems
nflseedR::load_sharpe_games() %>%
dplyr::filter(season %in% 2019:2020) %>%
dplyr::select(sim = season, game_type, week, away_team, home_team, result) %>%
nflseedR::compute_division_ranks() %>%
purrr::pluck("standings")
})
# Restore old options
options(old)
[Package
nflseedR version 1.2.0
Index]