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     2025               1      1 AUS    QB         QB          3918298
#>  2     2025               1      1 AUS    RB         RB          4430807
#>  3     2025               1      1 AUS    RB         RB          4047365
#>  4     2025               1      1 AUS    WR         WR          4241389
#>  5     2025               1      1 AUS    WR         WR          4374302
#>  6     2025               1      1 AUS    TE         TE          4430027
#>  7     2025               1      1 AUS    FLEX       FLEX        4047646
#>  8     2025               1      1 AUS    D/ST       D/ST         -16023
#>  9     2025               1      1 AUS    K          K           4362081
#> 10     2025               1      1 AUS    BE         BE          4239993
#> 11     2025               1      1 AUS    BE         BE            16800
#> 12     2025               1      1 AUS    BE         BE          4430878
#> 13     2025               1      1 AUS    BE         BE          4685382
#> 14     2025               1      1 AUS    BE         BE          4241416
#> 15     2025               1      1 AUS    BE         BE          4047650
#> 16     2025               1      1 AUS    BE         BE          4683062
#> # ℹ 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     2025               1      2 BOS    QB         QB          3916387
#>  2     2025               1      2 BOS    RB         RB          4429795
#>  3     2025               1      2 BOS    RB         RB          4242335
#>  4     2025               1      2 BOS    WR         WR          4362628
#>  5     2025               1      2 BOS    WR         WR          4595348
#>  6     2025               1      2 BOS    TE         TE          4036133
#>  7     2025               1      2 BOS    FLEX       FLEX        4426502
#>  8     2025               1      2 BOS    D/ST       D/ST         -16034
#>  9     2025               1      2 BOS    K          K           3953687
#> 10     2025               1      2 BOS    BE         BE          4430737
#> 11     2025               1      2 BOS    BE         BE          4362238
#> 12     2025               1      2 BOS    BE         BE          4379399
#> 13     2025               1      2 BOS    BE         BE          3915511
#> 14     2025               1      2 BOS    BE         BE          3054850
#> 15     2025               1      2 BOS    BE         BE          3915416
#> 16     2025               1      2 BOS    BE         BE          4428331
#> # ℹ 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     2025               1      3 CHI    QB         QB          4040715
#>  2     2025               1      3 CHI    RB         RB          3929630
#>  3     2025               1      3 CHI    RB         RB          4429160
#>  4     2025               1      3 CHI    WR         WR          4426515
#>  5     2025               1      3 CHI    WR         WR          4258173
#>  6     2025               1      3 CHI    TE         TE          4432665
#>  7     2025               1      3 CHI    FLEX       FLEX        4361307
#>  8     2025               1      3 CHI    D/ST       D/ST         -16016
#>  9     2025               1      3 CHI    K          K           4689936
#> 10     2025               1      3 CHI    BE         BE          3116406
#> 11     2025               1      3 CHI    BE         BE          3121422
#> 12     2025               1      3 CHI    BE         BE          4569618
#> 13     2025               1      3 CHI    BE         BE          4427366
#> 14     2025               1      3 CHI    BE         BE            16737
#> 15     2025               1      3 CHI    BE         BE          4259545
#> 16     2025               1      3 CHI    BE         BE          4429615
#> # ℹ 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     2025               1      4 DEN    QB         QB          4426348
#>  2     2025               1      4 DEN    RB         RB          3117251
#>  3     2025               1      4 DEN    RB         RB          4890973
#>  4     2025               1      4 DEN    WR         WR          4262921
#>  5     2025               1      4 DEN    WR         WR          4432773
#>  6     2025               1      4 DEN    TE         TE          3040151
#>  7     2025               1      4 DEN    FLEX       FLEX        3043078
#>  8     2025               1      4 DEN    D/ST       D/ST         -16007
#>  9     2025               1      4 DEN    K          K           3150744
#> 10     2025               1      4 DEN    BE         BE          4596448
#> 11     2025               1      4 DEN    BE         BE          4612826
#> 12     2025               1      4 DEN    BE         BE          4567048
#> 13     2025               1      4 DEN    BE         BE          3045147
#> 14     2025               1      4 DEN    BE         BE          4432708
#> 15     2025               1      4 DEN    BE         BE          3116385
#> 16     2025               1      4 DEN    BE         BE          3128429
#> # ℹ 10 more variables: firstName <chr>, lastName <chr>, proTeam <fct>,
#> #   position <fct>, injuryStatus <chr>, projectedScore <dbl>,
#> #   actualScore <dbl>, percentStarted <dbl>, percentOwned <dbl>,
#> #   percentChange <dbl>
#>