The score of each team in a matchup or scoring period and the match outcome.

tidy_scores(leagueId = ffl_id(), leagueHistory = FALSE, useMatchup = TRUE, ...)

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.

useMatchup

logical; Whether scoring should be summarized by matchupPeriodId (default) or scoringPeriodId. The later always relates to a single week of the NFL season, while fantasy matchups might span several scoring periods, especially in the playoffs.

...

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

Value

A tidy data frame of scores by team and matchup/scoring period.

Details

expectedWins are calculated by comparing a team score against all other scores for a given matchup period. This statistic expresses how a team would fair if the schedule was random The highest scoring team is thus expected to earn 1 win and the lowest scoring team would expect to win 0 matchups.

See also

Other scoring functions: live_scoring()

Examples

tidy_scores(leagueId = "42654852", useMatchup = FALSE)
#> # A tibble: 8 × 8
#>   seasonId scoringPeriodId matchupId teamId abbrev isHome points expectedWins
#>      <int>           <dbl>     <int>  <int> <fct>  <lgl>   <dbl>        <dbl>
#> 1     2026               1         1      1 AUS    TRUE    131.         0.333
#> 2     2026               1         1      3 CHI    FALSE    96.8        0    
#> 3     2026               1         2      2 BOS    TRUE    162.         1    
#> 4     2026               1         2      4 DEN    FALSE   146.         0.667
#> 5     2026               2         3      3 CHI    TRUE    115.         0.333
#> 6     2026               2         3      4 DEN    FALSE   103.         0    
#> 7     2026               2         4      1 AUS    TRUE    132.         0.667
#> 8     2026               2         4      2 BOS    FALSE   168.         1