Skip to contents

This function allows you to scrape each team's payroll from Spotrac.

Usage

sptrc_league_payrolls(year = most_recent_mlb_season())

Arguments

year

Year to load

Value

A data frame of contract data.

col_nametypes
yearcharacter
teamcharacter
team_abbrcharacter
ranknumeric
win_percentnumeric
rosternumeric
active_man_payrollnumeric
injured_reservenumeric
retainednumeric
buriednumeric
suspendednumeric
yearly_total_payrollnumeric

Examples

# \donttest{
  try(sptrc_league_payrolls(year = most_recent_mlb_season()))
#> ── MLB Payroll data from Spotrac.com ──────────────── baseballr 1.6.0 ──
#>  Data updated: 2024-04-13 21:57:24 UTC
#> # A tibble: 30 × 12
#>    year  team      team_abbr  rank win_percent roster active_man_payroll
#>    <chr> <chr>     <chr>     <dbl>       <dbl>  <dbl>              <dbl>
#>  1 2024  New York… NYM           1       0.462     26          212393173
#>  2 2024  New York… NYY           2       0.786     26          225310294
#>  3 2024  Houston … HOU           3       0.267     27          180214325
#>  4 2024  Philadel… PHI           4       0.5       26          221317653
#>  5 2024  Texas Ra… TEX           5       0.571     26          147600597
#>  6 2024  Atlanta … ATL           6       0.667     26          190598303
#>  7 2024  Toronto … TOR           7       0.429     26          204547890
#>  8 2024  Los Ange… LAD           8       0.625     26          184038062
#>  9 2024  Chicago … CHC           9       0.538     26          176362453
#> 10 2024  San Fran… SF           10       0.357     26          144576435
#> # ℹ 20 more rows
#> # ℹ 5 more variables: injured_reserve <dbl>, retained <dbl>,
#> #   buried <dbl>, suspended <dbl>, yearly_total_payroll <dbl>
# }