The ESPN algorithm simulates the entire season according to the projection and matchup schedule to calculate the probability of a team winning their division and making the playoffs.

league_simulation(leagueId = ffl_id(), leagueHistory = FALSE, ...)

Arguments

leagueId

Numeric league ID or ESPN fantasy page URL. Defaults to getOption("fflr.leagueId"). Function fails if no ID is found.

leagueHistory

logical; Should the leagueHistory version of the API be called? If TRUE, a list of results is returned, with one element for each historical year of the league.

...

Additional queries passed to httr::GET(). Arguments are converted to a named list and passed to query alongside view.

Value

A data frame of simulated team standings.

Examples

league_simulation(leagueId = "42654852")
#> # A tibble: 4 × 11
#>   seasonId teamId abbrev draftDayProjectedRank currentProjectedRank
#>      <int>  <int> <fct>                  <int>                <int>
#> 1     2024      1 AUS                        1                    1
#> 2     2024      2 BOS                        2                    2
#> 3     2024      3 CHI                        3                    3
#> 4     2024      4 DEN                        4                    4
#> # ℹ 6 more variables: simulatedRank <int>, simulatedWins <int>,
#> #   simulatedLosses <int>, simulatedTies <int>, playoffPct <dbl>,
#> #   divisionWinPct <dbl>