View source: R/0_ff_simulate.R
ff_simulate | R Documentation |
The main function of the package - uses bootstrap resampling to run fantasy football season simulations supported by historical rankings and nflfastR data, calculating optimal lineups, and returns aggregated results.
ff_simulate( conn, n_seasons = 100, n_weeks = 14, best_ball = FALSE, seed = NULL, gp_model = c("simple", "none"), base_seasons = 2012:2020, actual_schedule = FALSE, replacement_level = TRUE, pos_filter = c("QB", "RB", "WR", "TE", "K"), verbose = NULL, return = c("default", "all") )
conn |
an connection to a league made with |
n_seasons |
number of seasons to simulate, default = 100 |
n_weeks |
number of weeks per season, default = 14 |
best_ball |
a logical: are weekly wins based on optimal lineups? |
seed |
an integer to control reproducibility |
gp_model |
select between "simple", "none" to apply a model for whether a player played in a given game, defaults to "simple" |
base_seasons |
a numeric vector that selects seasons as base data, earliest available is 2012 |
actual_schedule |
a logical: use actual ff_schedule? default is FALSE |
replacement_level |
a logical: use best available on waiver as replacement level? defaults to TRUE |
pos_filter |
a character vector of positions to filter/run, default is c("QB","RB","WR","TE","K") |
verbose |
a logical: print status messages? default is TRUE, configure with options(ffsimulator.verbose) |
return |
one of c("default", "all") - what objects to return in the output list |
an ff_simulation
object which can be passed to plot()
and contains the output data from the simulation.
vignette("basic")
for example usage
vignette("custom")
for examples on using the subfunctions for your own processes.
try({ # try block to prevent CRAN-related issues conn <- mfl_connect(2021, 22627) ff_simulate(conn, n_seasons = 25) })
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.