The ffsimulator package uses bootstrap resampling to run fantasy football season simulations supported by historical rankings and nflfastR data, calculating optimal lineups, and returning aggregated results. This can quickly run your league through hundreds of seasons and can help you study:
This package is part of the ffverse family of R packages for fantasy football analysis.
Install the stable version of this package from CRAN or the ffverse r-universe repository:
install.packages("ffsimulator") # CRAN install.packages("ffsimulator", repos = "https://ffverse.r-universe.dev")
Install the development version with either DynastyProcess’s r-universe or remotes + GitHub:
# DynastyProcess's r-universe install.packages("ffsimulator", repos = "https://dynastyprocess.r-universe.dev") # or via GitHub c/o remotes/devtools: # install.packages('remotes') remotes::install_github("ffverse/ffsimulator", ref = "dev")
The development version has a separate documentation site here.
A season simulation can be run as follows:
library(ffsimulator) library(ggplot2) library(ggridges) mfl_conn <- mfl_connect(season = 2021, league_id = 22627) ## OTHER PLATFORM CONNECTIONS MAY BE USED, FOR EXAMPLE: # sleeper_conn <- sleeper_connect(season = 2021, league_id = "652582284720971776") # flea_conn <- fleaflicker_connect(season = 2021, league_id = 312861) # espn_conn <- espn_connect(season = 2021, league_id = 899513) mfl_sim <- ff_simulate(conn = mfl_conn, n_seasons = 100) plot(mfl_sim)
Please also see the
vignettes for more detailed introductions.
The best places to get help on this package are:
Many hands make light work! Here are some ways you can contribute to this project: