knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) options(knitr.kable.NA = '-')
nflseedR essentially performs two tasks:
nfl_standings()
based on game results of one or more seasons, especially taking into account the comprehensive and sometimes complicated tie-breaking procedures for division ranks, conference seeds and the draft order. Read this article for further information on the implemented tie-breakers.nfl_simulations()
. The standings from point 1 and especially the conference seeds are needed to determine playoff participants. Basically, the first point only exists because we need it to carry out the simulations.The actual core of a simulation is the generation of game results based on any information that the user deems important. This is why nflseedR is virtually extensible. By default, a simple ELO model is implemented that works with initial starting ELO values and updates them from week to week based on game results. However, the user can write their own function for calculating game results and pass it to nflseedR together with any additional data that may be required.
We need real or simulated match data to determine standings. The required variables are specified in the documentation of the function nfl_standings()
.
Here are games data from the 2023 and 2024 seasons.
games <- nflreadr::load_schedules(2023:2024)
We can pass this data directly to nflseedR and calculate standings. It defaults to compute division ranks as well as conference ranks for all teams and it applies tiebreakers through strength of schedule.
standings <- nflseedR::nfl_standings(games, ranks = "DRAFT") # Let's view the structure of the output str(standings, max.level = 1, width = 50, strict.width = "cut")
nflseedR also provides functionality to create a "pretty" html table using the {gt}
package. Use nfl_standings_prettify()
with the output of nfl_standings()
to create the table. It allows grouping by division, conference or overall and it can sort by division rank, conference rank (seed), and draft rank.
The default groups by division and sorts by division rank.
# It doesn't allow more than one season s <- standings[season == 2024] nflseedR::nfl_standings_prettify(s)
But we can also do things like ordering the complete league by draft rank.
nflseedR::nfl_standings_prettify(s, grp_by = "nfl", order_by = "draft_rank")
Please note that nfl_standings_prettify()
returns a gt::gt()
table so you can change it according to your own preferences.
With nflseedR 2.0, we have rethought and implemented the execution of simulations from scratch. Particular attention was paid to flexibility and performance. As the usage of the new function nfl_simulations()
differs from the old function simulate_nfl()
, we will keep both variants for the time being and maintain two separate articles explaining how to use them.
It is strongly recommended to switch to nfl_simulations()
because it is far superior to the old implementation in practically every respect, especially in terms of performance.
nfl_simulations()
simulate_nfl()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.