wOBA_values: Return wOBA values per season

Description Usage Arguments Examples

View source: R/woba_values.R

Description

Get wOBA values for each year in your database. This calculation requires all fields of the Pitching, Fielding and Batting tables from the Lahman package, or a comparable data set. The function uses a version of Tom Tango's wOBA formula by default, but can also return Fangraphs wOBA values.

Usage

1
2
wOBA_values(BattingTable, PitchingTable, FieldingTable,
  Sep.Leagues = FALSE, Fangraphs = 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.

Sep.Leagues

If TRUE, this will split the calculation and return unique wOBA values for the various leagues. This can be helpful in handling Designated Hitters and National League pitchers. It also isolates the park factors to their respective leagues.

Fangraphs

if TRUE the function will return the Fangraphs wOBA values. By default the function uses a method adapted from Tom Tango. These values are often very close to Fangraphs, but are not the same due to Fangraphs using a different algorithm. This can not be used in conjunction with the Sep.Leagues argument because Fangraphs does not separate FIP constants by league.

Examples

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

woba_df <- wOBA_values(Batting2016, Pitching2016, Fielding2016, Sep.Leagues=FALSE, Fangraphs=FALSE)

keberwein/moneyball documentation built on May 20, 2019, 8:29 a.m.