tidy_scores: Fantasy matchup scores

View source: R/scores.R

tidy_scoresR Documentation

Fantasy matchup scores

Description

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

Usage

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.

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.

Value

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

See Also

Other scoring functions: live_scoring()

Examples

tidy_scores(leagueId = "42654852", useMatchup = FALSE)

fflr documentation built on Sept. 14, 2023, 9:10 a.m.