
Scrape League Payroll Breakdowns from Spotrac
Source:R/sptrc_league_payrolls.R
sptrc_league_payrolls.RdThis function allows you to scrape each team's payroll from Spotrac.
Usage
sptrc_league_payrolls(year = most_recent_mlb_season())Value
A data frame of contract data.
| col_name | types | description |
| year | character | Payroll season. |
| team | character | Full team name. |
| team_abbr | character | Team abbreviation. |
| rank | numeric | League rank by total payroll allocations. |
| record | character | Team win-loss record for the season. |
| avg_age_team | character | Roster-weighted average age of the team. |
| total_payroll_allocations | numeric | Total payroll allocations across all roster statuses (USD). |
| active_26_man | numeric | Payroll allocated to the active 26-man roster (USD). |
| injured | numeric | Payroll allocated to players on the injured list (USD). |
| retained | numeric | Retained salary owed to players no longer on the roster (USD). |
| buried | numeric | Payroll for players assigned to the minors ("buried" contracts) (USD). |
Column names after rank mirror Spotrac's current league-payroll table and
may change as Spotrac updates its layout.
Examples
# \donttest{
try(sptrc_league_payrolls(year = most_recent_mlb_season()))
#> ✖ 2026-09-10 00:50:35.156743: Invalid arguments or no contract data available!
#> data frame with 0 columns and 0 rows
# }