Skip to contents

This function allows you to calculate FIP and related metrics for any given set of data, provided the right variables are in the data set. The function currently returns both FIP per inning pitched, wOBA against (based on batters faced), and wOBA against per instance of fair contact.

Usage

fip_plus(df)

Arguments

df

A data frame of statistics that includes, at a minimum, the following columns: IP (innings pitched), BF (batters faced), 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.

Value

Returns a tibble with the following columns:

col_nametypes
bbref_idcharacter
seasoninteger
Namecharacter
Agenumeric
Levelcharacter
Teamcharacter
Gnumeric
GSnumeric
Wnumeric
Lnumeric
SVnumeric
IPnumeric
Hnumeric
Rnumeric
ERnumeric
uBBnumeric
BBnumeric
SOnumeric
HRnumeric
HBPnumeric
ERAnumeric
ABnumeric
X1Bnumeric
X2Bnumeric
X3Bnumeric
IBBnumeric
GDPnumeric
SFnumeric
SBnumeric
CSnumeric
POnumeric
BFnumeric
Pitnumeric
Strnumeric
StLnumeric
StSnumeric
GB.FBnumeric
LDnumeric
PUnumeric
WHIPnumeric
BAbipnumeric
SO9numeric
SO.Wnumeric
SO_percnumeric
uBB_percnumeric
SO_uBBnumeric
FIPnumeric
wOBA_againstnumeric
wOBA_CON_againstnumeric

Examples

# \donttest{
  df <- bref_daily_pitcher("2015-04-05", "2015-04-30")
  try(fip_plus(df))
#> ── MLB Daily Pitcher data from baseball-reference.com ──────────────────
#>  Data updated: 2022-09-09 07:38:26 UTC
#> # A tibble: 453 × 49
#>    bbref_id season Name    Age Level Team      G    GS     W     L    SV
#>    <chr>     <int> <chr> <dbl> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1 453265     2015 Heat…    26 Maj-… Bost…     1     0    NA    NA    NA
#>  2 592879     2015 Dere…    28 Maj-… Texas     1     1    NA     1    NA
#>  3 519455     2015 Jon …    27 Maj-… Texas     1     0    NA    NA    NA
#>  4 453264     2015 Cory…    25 Maj-… San …     2     0    NA    NA    NA
#>  5 501957     2015 Seve…    22 Maj-… Phil…     1     1    NA     1    NA
#>  6 573244     2015 John…    26 Maj-… Atla…     1     0    NA    NA    NA
#>  7 445612     2015 Chri…    27 Maj-… San …     5     0    NA    NA    NA
#>  8 458677     2015 Donn…    30 Maj-… Atla…     1     0    NA    NA    NA
#>  9 425532     2015 Jorg…    27 Maj-… Colo…     1     0    NA    NA    NA
#> 10 425794     2015 Anth…    25 Maj-… Texas     1     1    NA     1    NA
#> # … with 443 more rows, and 38 more variables: IP <dbl>, H <dbl>,
#> #   R <dbl>, ER <dbl>, uBB <dbl>, BB <dbl>, SO <dbl>, HR <dbl>,
#> #   HBP <dbl>, ERA <dbl>, AB <dbl>, X1B <dbl>, X2B <dbl>, X3B <dbl>,
#> #   IBB <dbl>, GDP <dbl>, SF <dbl>, SB <dbl>, CS <dbl>, PO <dbl>,
#> #   BF <dbl>, Pit <dbl>, Str <dbl>, StL <dbl>, StS <dbl>, GB.FB <dbl>,
#> #   LD <dbl>, PU <dbl>, WHIP <dbl>, BAbip <dbl>, SO9 <dbl>, SO.W <dbl>,
#> #   SO_perc <dbl>, uBB_perc <dbl>, SO_uBB <dbl>, FIP <dbl>, …
# }