Skip to contents

This function simulates a single upcoming week using the same methodology as in the season-long simulation, ff_simulate().

Usage

ff_simulate_week(
  conn,
  n = 1000,
  best_ball = FALSE,
  seed = NULL,
  base_seasons = 2012:2022,
  actual_schedule = TRUE,
  replacement_level = FALSE,
  pos_filter = c("QB", "RB", "WR", "TE", "K"),
  verbose = NULL,
  return = c("default", "all")
)

Arguments

conn

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

n

number of times to simulate the upcoming week, default is 1000

best_ball

a logical: are weekly wins based on optimal lineups?

seed

an integer to control reproducibility

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 TRUE

replacement_level

a logical: use best available on waiver as replacement level? defaults to FALSE for upcoming week simulations

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

Value

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

See also

vignette("basic") for example usage

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

Examples

# \donttest{
try({ # try block to prevent CRAN-related issues
conn <- mfl_connect(2021, 22627)
ff_simulate_week(conn, n = 1000, actual_schedule = TRUE)
})
#> ── Starting simulation 2024-10-03 14:20:35.614833 ──────────────────────────────
#>  Importing data
#>  Importing data ... done
#> 
#> Warning: no non-missing arguments to min; returning Inf
#>  No unplayed weeks to simulate!
#> <ff_simulation:  simulated seasons of Four-Eight Dynasty League>
#> List of 3
#>  $ schedule         : tibble [180 × 6] (S3: tbl_df/tbl/data.frame)
#>  $ league_info      : tibble [1 × 17] (S3: tbl_df/tbl/data.frame)
#>  $ simulation_params:List of 6
# }