Learn R Programming

ffsimulator (version 1.2.3)

ff_simulate: Simulate Fantasy Seasons

Description

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.

Usage

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")
)

Value

an ff_simulation object which can be passed to plot() and contains the output data from the simulation.

Arguments

conn

an connection to a league made with ff_connect() and friends (required)

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

See Also

vignette("basic") for example usage

vignette("custom") for examples on using the subfunctions for your own processes.

Examples

Run this code
# \donttest{
try({ # try block to prevent CRAN-related issues
conn <- mfl_connect(2021, 22627)
ff_simulate(conn, n_seasons = 25)
})
# }

Run the code above in your browser using DataLab