wOBA: Batting: Calculate Weighted On-Base Average (wOBA)

Description Usage Arguments See Also Examples

Description

Find the wOBA for all players with one or more hits for a particular season. Required fields from the batting table are "AB", "H", "BB", "X2B", "X3B", "HR", "HBP", "SF", "IBB."

Usage

1
2
wOBA(BattingTable = NULL, PitchingTable = NULL, FieldingTable = NULL,
  Fangraphs = FALSE, NA_to_zero = TRUE, Sep.Leagues = FALSE)

Arguments

BattingTable

A full batting table from the Lahman package or the Chadwick Bureau GitHub repository. Any subsetting or removal of players will affect your results. All players for each year are recommended.

PitchingTable

A full pitching table from the Lahman package or the Chadwick Bureau GitHub repository. Any subsetting or removal of players will affect your results. All players for each year are recommended.

FieldingTable

A full batting table from the Lahman package or the Chadwick Bureau GitHub repository. Any subsetting or removal of players will affect your results. All players for each year are recommended.

Fangraphs

If TRUE the function will download wOBA values from Fangraphs. If FALSE the function will use the internal formula adapted from Tom Tango's original wOBA formula. Note, the internal formula is typically identical to Fangraphs and does not require an external download. If not specified, the default is set to FALSE.

NA_to_zero

If TRUE this will replace NAs with 0 for years that certain stats were not counted. For example, sacrifice hits were not a counted statistic until 1954, therefore we are technically unable to calculate wOBA for any player prior to 1954. The default is set to TRUE. Even though this is bad practice mathematically, many in the sabermetrics community accept the practice. If FALSE, the wOBA calculation will return NaN for years with missing data.

Sep.Leagues

If TRUE the algorithm will calculate different run environments for the National and American leagues. Grouping the leagues can solve problems introduced by the designated hitter and hitting pitchers. It also serves to further isolate for park factors between the American and National leagues. The default for this argument is FALSE.

See Also

Other Batting functions: BABIP, BA, BBpct, CTpct, HRpct, ISO, Kpct, OBP, OPS, PA, RC2002, RCbasic, RCtech, SLG, TBs, XBHpct, XBperH, wRAA, wRC

Examples

1
2
3
4
5
6
7
8
9
data("Batting2016")
head(Batting2016)
data("Pitching2016")
head(Pitching2016)
data("Fielding2016")
head(Fielding2016)

Batting2016$wOBA <- wOBA(Batting2016, Pitching2016, Fielding2016, Fangraphs=FALSE,
                          NA_to_zero=TRUE, Sep.Leagues=FALSE)

baseballDBR documentation built on May 2, 2019, 5:56 a.m.