sabr

The sabr package connects the Lahman SQL Database with functions used in calculating offensive performance in the MLB, namely wOBA. Created by Tom Tango and popularized in The Book: Playing the Percentages in Baseball, wOBA uses yearly MLB performance to weigh offensive measures relative to league value. This package offers the following capabilities:

Installation:

Motivation:

wOBA is one of the best catch-all offensive performance statistics, but it's formula is a bit convoluted since it requires 1) ten distinct rate stats and 2) weighted values based on a season's run environment.

For example, the wOBA formula for the 2013 season was:

wOBA = (0.690×uBB + 0.722×HBP + 0.888×1B + 1.271×2B + 1.616×3B + 2.101×HR) / (AB + BB – IBB + SF + HBP)

Check out Fangraphs' library for additional details.

New Functions with 0.2:

library(sabr)
wRAA_season("braunry02","2015")
wRC_season("molitpa01","1991")
wRCp_season("yountro01","1989")

Full calculation details are in the wOBA and wRC+ calculation.Rmd file

wRCp_season makes a couple assumptions: 1. Park Factors are pulled from the Lahman Database - these are different from other sources 2. A player's primary position is used to remove pitchers from the League Runs/Plate Appearance calculation


Key Functions from 0.1:

battingseason("parrage01","2014")
battingcareer("fieldpr01")
woba_season("fieldpr01","2014")
lahman_search(nameFirst = "Robin")
lahman_search(nameLast = "Fielder")
lahman_search(nameGiven = "Russell Oles")
lahman_search(retroID = "molip001")
lahman_search(bbrefID = "yostne01")

Have a question, issue or suggestion? Create a pull request, file an issue, or feel free to contact me on Twitter or my website!



mdlee12/sabr documentation built on May 22, 2019, 3:37 p.m.