Skip to contents

Check the completion flag before treating a score as a final result. A score can be missing for a scheduled event. The live response's last_update records when the response was built. The sandbox returns fictional events and accepts no lookback or date-format options.

Usage

pa_scores(
  sport,
  days_from = NULL,
  date_format = c("iso", "unix"),
  sandbox = NULL
)

Arguments

sport

A sport key such as "basketball_nba" or a short league name such as "nba", "nfl", "nhl" or "epl". See pa_sports().

days_from

Optional whole number from 1 to 14. Where score history is available, requesting completed events over this lookback uses two credits instead of the base one credit.

date_format

Live timestamps in ISO format ("iso") or Unix seconds ("unix").

sandbox

Logical or NULL. TRUE uses the keyless sandbox endpoint, FALSE the live endpoint, NULL (default) defers to the global pa_sandbox() toggle.

Value

A data frame with one row per returned event. The scores list-column holds team names and score values when available. An empty result has zero rows.

Examples

# \donttest{
games <- pa_scores("basketball_nba", sandbox = TRUE)
games[, c("id", "home_team", "away_team", "completed")]
# }