Uses the roster settings for each league to find the best possible combinations of players to score the most fantasy points.

best_roster(
  leagueId = ffl_id(),
  useScore = c("actualScore", "projectedScore"),
  scoringPeriodId = NULL,
  replacement = FALSE,
  replacementRank = 1,
  ...
)

Arguments

leagueId

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

useScore

One of "projectedScore" or "actualScore" (default).

scoringPeriodId

Integer week of NFL season. By default, NULL will use the current week (see ffl_week()). Scoring periods are always one week in length, whereas matchups might be longer.

replacement

If TRUE, let each lineup start replacement-level stand-ins from the waiver wire, and add each player's score over replacement. Defaults to FALSE.

replacementRank

Which available player at each position is the stand-in: 1 (default) is the best one that week.

...

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

Value

A list of data frames with optimal rosters, one per team. With replacement = TRUE, stand-ins are rows with replacement set to TRUE, and overReplacement is each player's score minus the stand-in's at the same position (NA for positions without one).

Details

If scoringPeriodId is the current week (the default), then actual scoring might be incomplete (see projectedScore argument).

With replacement = TRUE, each lineup can also start a replacement-level stand-in from the waiver wire at each position, as in evaluate_trade(): the replacementRank-th best score that week among today's most-rostered available players at that position. A stand-in only appears where it beats every eligible player on the roster, so it shows where a lineup is below waiver level; waiver_upgrades() says who to drop for them.

Examples

best_roster(leagueId = "42654852", scoringPeriodId = 1)
#> $AUS
#> # A tibble: 16 × 17
#>    seasonId scoringPeriodId teamId abbrev lineupSlot actualSlot playerId
#>       <int>           <int>  <int> <fct>  <fct>      <fct>         <int>
#>  1     2026               1      1 AUS    QB         QB          4426348
#>  2     2026               1      1 AUS    RB         BE          4567048
#>  3     2026               1      1 AUS    RB         BE          4696981
#>  4     2026               1      1 AUS    WR         WR          4374302
#>  5     2026               1      1 AUS    WR         BE          4429615
#>  6     2026               1      1 AUS    TE         TE          4361307
#>  7     2026               1      1 AUS    FLEX       BE          3915416
#>  8     2026               1      1 AUS    D/ST       D/ST         -16026
#>  9     2026               1      1 AUS    K          K           3953687
#> 10     2026               1      1 AUS    BE         BE          4569618
#> 11     2026               1      1 AUS    BE         FLEX        4870808
#> 12     2026               1      1 AUS    BE         WR          4426515
#> 13     2026               1      1 AUS    BE         RB          4429160
#> 14     2026               1      1 AUS    BE         BE          4685472
#> 15     2026               1      1 AUS    BE         RB          4685382
#> 16     2026               1      1 AUS    BE         BE            16800
#> # ℹ 10 more variables: firstName <chr>, lastName <chr>, proTeam <fct>,
#> #   position <fct>, injuryStatus <chr>, projectedScore <dbl>,
#> #   actualScore <dbl>, percentStarted <dbl>, percentOwned <dbl>,
#> #   percentChange <dbl>
#> 
#> $BOS
#> # A tibble: 16 × 17
#>    seasonId scoringPeriodId teamId abbrev lineupSlot actualSlot playerId
#>       <int>           <int>  <int> <fct>  <fct>      <fct>         <int>
#>  1     2026               1      2 BOS    QB         QB          3918298
#>  2     2026               1      2 BOS    RB         FLEX        3043078
#>  3     2026               1      2 BOS    RB         RB          4430807
#>  4     2026               1      2 BOS    WR         WR          4430878
#>  5     2026               1      2 BOS    WR         BE          4612826
#>  6     2026               1      2 BOS    TE         TE          4723086
#>  7     2026               1      2 BOS    FLEX       BE          4361579
#>  8     2026               1      2 BOS    D/ST       D/ST         -16007
#>  9     2026               1      2 BOS    K          K           2473037
#> 10     2026               1      2 BOS    BE         BE          4596448
#> 11     2026               1      2 BOS    BE         WR          4241389
#> 12     2026               1      2 BOS    BE         BE          4428331
#> 13     2026               1      2 BOS    BE         BE          4882093
#> 14     2026               1      2 BOS    BE         RB          3929630
#> 15     2026               1      2 BOS    BE         BE          4241478
#> 16     2026               1      2 BOS    BE         BE          4431299
#> # ℹ 10 more variables: firstName <chr>, lastName <chr>, proTeam <fct>,
#> #   position <fct>, injuryStatus <chr>, projectedScore <dbl>,
#> #   actualScore <dbl>, percentStarted <dbl>, percentOwned <dbl>,
#> #   percentChange <dbl>
#> 
#> $CHI
#> # A tibble: 16 × 17
#>    seasonId scoringPeriodId teamId abbrev lineupSlot actualSlot playerId
#>       <int>           <int>  <int> <fct>  <fct>      <fct>         <int>
#>  1     2026               1      3 CHI    QB         QB          4431452
#>  2     2026               1      3 CHI    RB         RB          4429795
#>  3     2026               1      3 CHI    RB         RB          4242335
#>  4     2026               1      3 CHI    WR         BE          4361370
#>  5     2026               1      3 CHI    WR         BE          4258173
#>  6     2026               1      3 CHI    TE         TE          4431459
#>  7     2026               1      3 CHI    FLEX       BE          4430737
#>  8     2026               1      3 CHI    D/ST       D/ST         -16034
#>  9     2026               1      3 CHI    K          K           4574716
#> 10     2026               1      3 CHI    BE         BE          4595348
#> 11     2026               1      3 CHI    BE         BE          4567750
#> 12     2026               1      3 CHI    BE         FLEX        4379399
#> 13     2026               1      3 CHI    BE         BE          4685702
#> 14     2026               1      3 CHI    BE         WR          4047646
#> 15     2026               1      3 CHI    BE         WR          4426502
#> 16     2026               1      3 CHI    BE         BE          4372016
#> # ℹ 10 more variables: firstName <chr>, lastName <chr>, proTeam <fct>,
#> #   position <fct>, injuryStatus <chr>, projectedScore <dbl>,
#> #   actualScore <dbl>, percentStarted <dbl>, percentOwned <dbl>,
#> #   percentChange <dbl>
#> 
#> $DEN
#> # A tibble: 16 × 17
#>    seasonId scoringPeriodId teamId abbrev lineupSlot actualSlot playerId
#>       <int>           <int>  <int> <fct>  <fct>      <fct>         <int>
#>  1     2026               1      4 DEN    QB         QB          3916387
#>  2     2026               1      4 DEN    RB         FLEX        4890973
#>  3     2026               1      4 DEN    RB         BE          4259545
#>  4     2026               1      4 DEN    WR         WR          4262921
#>  5     2026               1      4 DEN    WR         BE          4239993
#>  6     2026               1      4 DEN    TE         TE          4432665
#>  7     2026               1      4 DEN    FLEX       BE          4427366
#>  8     2026               1      4 DEN    D/ST       D/ST         -16023
#>  9     2026               1      4 DEN    K          K           4362081
#> 10     2026               1      4 DEN    BE         RB          4362238
#> 11     2026               1      4 DEN    BE         BE          4239996
#> 12     2026               1      4 DEN    BE         RB          3117251
#> 13     2026               1      4 DEN    BE         BE          4426388
#> 14     2026               1      4 DEN    BE         BE          4426354
#> 15     2026               1      4 DEN    BE         BE          3121422
#> 16     2026               1      4 DEN    BE         WR          4362628
#> # ℹ 10 more variables: firstName <chr>, lastName <chr>, proTeam <fct>,
#> #   position <fct>, injuryStatus <chr>, projectedScore <dbl>,
#> #   actualScore <dbl>, percentStarted <dbl>, percentOwned <dbl>,
#> #   percentChange <dbl>
#>