wRC {baseballDBR} | R Documentation |
Find the wRC 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."
wRC(BattingTable = NULL, PitchingTable = NULL, FieldingTable = NULL, Fangraphs = FALSE, NA_to_zero = TRUE, Sep.Leagues = FALSE)
BattingTable |
A full batting table from the |
PitchingTable |
A full pitching table from the |
FieldingTable |
A full fielding table from the |
Fangraphs |
If TRUE the function will download wOBA values from Fangraphs. Both wOBA scale and league wOBA are used in the wRC calculation. If FALSE the function will use the internal wOBA algorithm, which is adapted from Tom Tango's original wOBA formula. This algorithm produces a slightly different wOBA scale than the Fangraphs wOBA scale, so variations in wRC should be expected. The default internal method does not require an external download from Fangraphs. 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 wRC 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 wRC 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. |
Other Batting functions: BABIP
,
BA
, BBpct
,
CTpct
, HRpct
,
ISO
, Kpct
, OBP
,
OPS
, PA
,
RC2002
, RCbasic
,
RCtech
, SLG
,
TBs
, XBHpct
,
XBperH
, wOBA
,
wRAA
data("Batting2016") head(Batting2016) data("Pitching2016") head(Pitching2016) data("Fielding2016") head(Fielding2016) Batting2016$wRC <- wRC(Batting2016, Pitching2016, Fielding2016, Fangraphs=FALSE, NA_to_zero=TRUE, Sep.Leagues=FALSE)