mlb_model_loaders: *Load pre-computed MLB model datasets from the...

mlb_model_loadersR Documentation

Load pre-computed MLB model datasets from the SportsDataverse data repo

Description

Season-level loaders for the modeled MLB datasets published on the sportsdataverse-data releases, mirroring sportsdataverse-py's ⁠load_mlb_*⁠ loader surface:

  • load_mlb_expected_stats() / load_mlb_expected_hr() / load_mlb_batter_projection() – hitting models (xBA/xwOBA-style expected stats, expected home runs, and blended batter projections).

  • load_mlb_stuff_plus() / load_mlb_command_plus() / load_mlb_xera() – pitching models (Stuff+, Command+, and expected ERA).

  • load_mlb_oaa() / load_mlb_catcher_framing() – fielding models (outs above average and catcher framing runs).

  • load_mlb_re24_matrix() / load_mlb_we_table() / load_mlb_wpa() – game-state references (run-expectancy matrix, win-expectancy table, and per-play win probability added).

Coverage starts in 2015 (2016 for load_mlb_batter_projection()) and runs through the most recent season.

Usage

load_mlb_expected_stats(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mlb_expected_hr(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mlb_batter_projection(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mlb_stuff_plus(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mlb_command_plus(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mlb_xera(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mlb_oaa(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mlb_catcher_framing(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mlb_re24_matrix(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mlb_we_table(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mlb_wpa(
  seasons = most_recent_mlb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

Arguments

seasons

A vector of 4-digit seasons, or TRUE for every published season.

...

Additional arguments passed to the underlying database write.

dbConnection

A DBIConnection object, as returned by DBI::dbConnect()

tablename

The name of the data table within the database

Value

A baseballr_data tibble (one row per player-season, or per game-state cell for the game-state references).

Examples


  try(load_mlb_expected_stats(2024))


baseballr documentation built on Aug. 27, 2026, 1:07 a.m.