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,
  ...
)

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.

...

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

Value

A dataframe (or list) with optimal rosters.

Details

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

See also

Other roster functions: roster_score(), start_roster(), team_roster()

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         RB          4429160
#>  3     2026               1      1 AUS    RB         RB          4685382
#>  4     2026               1      1 AUS    WR         WR          4426515
#>  5     2026               1      1 AUS    WR         WR          4374302
#>  6     2026               1      1 AUS    TE         TE          4361307
#>  7     2026               1      1 AUS    FLEX       FLEX        4870808
#>  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          4567048
#> 11     2026               1      1 AUS    BE         BE          4569618
#> 12     2026               1      1 AUS    BE         BE          4685472
#> 13     2026               1      1 AUS    BE         BE          4429615
#> 14     2026               1      1 AUS    BE         BE            16800
#> 15     2026               1      1 AUS    BE         BE          4696981
#> 16     2026               1      1 AUS    BE         BE          3915416
#> # ℹ 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         RB          4430807
#>  3     2026               1      2 BOS    RB         RB          3929630
#>  4     2026               1      2 BOS    WR         WR          4430878
#>  5     2026               1      2 BOS    WR         WR          4241389
#>  6     2026               1      2 BOS    TE         TE          4723086
#>  7     2026               1      2 BOS    FLEX       FLEX        3043078
#>  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          4428331
#> 11     2026               1      2 BOS    BE         BE          4361579
#> 12     2026               1      2 BOS    BE         BE          4241478
#> 13     2026               1      2 BOS    BE         BE          4612826
#> 14     2026               1      2 BOS    BE         BE          4882093
#> 15     2026               1      2 BOS    BE         BE          4596448
#> 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         WR          4426502
#>  5     2026               1      3 CHI    WR         WR          4047646
#>  6     2026               1      3 CHI    TE         TE          4431459
#>  7     2026               1      3 CHI    FLEX       FLEX        4379399
#>  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          4258173
#> 11     2026               1      3 CHI    BE         BE          4361370
#> 12     2026               1      3 CHI    BE         BE          4430737
#> 13     2026               1      3 CHI    BE         BE          4595348
#> 14     2026               1      3 CHI    BE         BE          4567750
#> 15     2026               1      3 CHI    BE         BE          4685702
#> 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         RB          3117251
#>  3     2026               1      4 DEN    RB         RB          4362238
#>  4     2026               1      4 DEN    WR         WR          4362628
#>  5     2026               1      4 DEN    WR         WR          4262921
#>  6     2026               1      4 DEN    TE         TE          4432665
#>  7     2026               1      4 DEN    FLEX       FLEX        4890973
#>  8     2026               1      4 DEN    D/ST       D/ST         -16023
#>  9     2026               1      4 DEN    K          K           4362081
#> 10     2026               1      4 DEN    BE         BE          4426354
#> 11     2026               1      4 DEN    BE         BE          4427366
#> 12     2026               1      4 DEN    BE         BE          4239996
#> 13     2026               1      4 DEN    BE         BE          4239993
#> 14     2026               1      4 DEN    BE         BE          4259545
#> 15     2026               1      4 DEN    BE         BE          3121422
#> 16     2026               1      4 DEN    BE         BE          4426388
#> # ℹ 10 more variables: firstName <chr>, lastName <chr>, proTeam <fct>,
#> #   position <fct>, injuryStatus <chr>, projectedScore <dbl>,
#> #   actualScore <dbl>, percentStarted <dbl>, percentOwned <dbl>,
#> #   percentChange <dbl>
#>