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     2024               1      1 AUS    QB         QB          3139477
#>  2     2024               1      1 AUS    RB         RB          3117251
#>  3     2024               1      1 AUS    RB         RB          4242335
#>  4     2024               1      1 AUS    WR         WR          3116406
#>  5     2024               1      1 AUS    WR         WR          4361370
#>  6     2024               1      1 AUS    TE         TE            15847
#>  7     2024               1      1 AUS    FLEX       FLEX        4361529
#>  8     2024               1      1 AUS    D/ST       D/ST         -16005
#>  9     2024               1      1 AUS    K          K           2971573
#> 10     2024               1      1 AUS    BE         BE          3116385
#> 11     2024               1      1 AUS    BE         BE          4047650
#> 12     2024               1      1 AUS    BE         BE          3054850
#> 13     2024               1      1 AUS    BE         BE          4241478
#> 14     2024               1      1 AUS    BE         BE          4595348
#> 15     2024               1      1 AUS    BE         BE          4569173
#> 16     2024               1      1 AUS    BE         BE          4239993
#> # ℹ 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     2024               1      2 BOS    QB         QB          4429084
#>  2     2024               1      2 BOS    RB         RB          4430737
#>  3     2024               1      2 BOS    RB         RB          3043078
#>  4     2024               1      2 BOS    WR         WR          4241389
#>  5     2024               1      2 BOS    WR         WR          4362628
#>  6     2024               1      2 BOS    TE         TE          4430027
#>  7     2024               1      2 BOS    FLEX       FLEX        4047646
#>  8     2024               1      2 BOS    D/ST       D/ST         -16006
#>  9     2024               1      2 BOS    K          K           3953687
#> 10     2024               1      2 BOS    BE         BE          4426502
#> 11     2024               1      2 BOS    BE         BE          4697815
#> 12     2024               1      2 BOS    BE         BE          2976212
#> 13     2024               1      2 BOS    BE         BE          3915416
#> 14     2024               1      2 BOS    BE         BE          3126486
#> 15     2024               1      2 BOS    BE         BE          3916387
#> 16     2024               1      2 BOS    BE         BE          4366031
#> # ℹ 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     2024               1      3 CHI    QB         QB          3918298
#>  2     2024               1      3 CHI    RB         RB          4430807
#>  3     2024               1      3 CHI    RB         RB          4239996
#>  4     2024               1      3 CHI    WR         WR          4262921
#>  5     2024               1      3 CHI    WR         WR          4569618
#>  6     2024               1      3 CHI    TE         TE          3116365
#>  7     2024               1      3 CHI    FLEX       FLEX        4426515
#>  8     2024               1      3 CHI    D/ST       D/ST         -16033
#>  9     2024               1      3 CHI    K          K             15683
#> 10     2024               1      3 CHI    BE         BE          4432708
#> 11     2024               1      3 CHI    BE         BE          4429160
#> 12     2024               1      3 CHI    BE         BE          4258173
#> 13     2024               1      3 CHI    BE         BE          4360438
#> 14     2024               1      3 CHI    BE         BE          4567048
#> 15     2024               1      3 CHI    BE         BE          3042519
#> 16     2024               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     2024               1      4 DEN    QB         QB          4040715
#>  2     2024               1      4 DEN    RB         RB          4427366
#>  3     2024               1      4 DEN    RB         RB          3929630
#>  4     2024               1      4 DEN    WR         WR          4374302
#>  5     2024               1      4 DEN    WR         WR          4035687
#>  6     2024               1      4 DEN    TE         TE          4361307
#>  7     2024               1      4 DEN    FLEX       FLEX        4429795
#>  8     2024               1      4 DEN    D/ST       D/ST         -16025
#>  9     2024               1      4 DEN    K          K           3050478
#> 10     2024               1      4 DEN    BE         BE            16800
#> 11     2024               1      4 DEN    BE         BE          4379399
#> 12     2024               1      4 DEN    BE         BE            16737
#> 13     2024               1      4 DEN    BE         BE          4047365
#> 14     2024               1      4 DEN    BE         BE          4372016
#> 15     2024               1      4 DEN    BE         BE          2977187
#> 16     2024               1      4 DEN    BE         BE          3925357
#> # ℹ 10 more variables: firstName <chr>, lastName <chr>, proTeam <fct>,
#> #   position <fct>, injuryStatus <chr>, projectedScore <dbl>,
#> #   actualScore <dbl>, percentStarted <dbl>, percentOwned <dbl>,
#> #   percentChange <dbl>
#>