Learn R Programming

baseballr (version 1.6.0)

woba_plus: Calculate wOBA and related metrics for any set of data

Description

This function allows you to calculate wOBA for any given set of data, provided the right variables are in the data set. The function currently returns both wOBA per plate appearance on wOBA per instance of fair contact.

Usage

woba_plus(df)

Value

Returns a tibble with the wOBA factors calculated and the following columns:

col_nametypes
bbref_idcharacter
seasoninteger
Namecharacter
Agenumeric
Levelcharacter
Teamcharacter
Gnumeric
PAnumeric
ABnumeric
Rnumeric
Hnumeric
X1Bnumeric
X2Bnumeric
X3Bnumeric
HRnumeric
RBInumeric
BBnumeric
IBBnumeric
uBBnumeric
SOnumeric
HBPnumeric
SHnumeric
SFnumeric
GDPnumeric
SBnumeric
CSnumeric
BAnumeric
OBPnumeric
SLGnumeric
OPSnumeric
wOBAnumeric
wOBA_CONnumeric

Arguments

df

A data frame of statistics that includes, at a minimum, the following columns: uBB (unintentional walks), HBP (Hit By Pitch), X1B (singles), X2B (doubles), X3B (triples), HR (home runs), AB (at-bats), SH (sacrifice hits), SO (strike outs), and season.

Examples

Run this code
# \donttest{
 try({
   df <- bref_daily_batter("2015-08-01", "2015-10-03") 
   woba_plus(df)
 })
# }

Run the code above in your browser using DataLab