View source: R/metrics_woba_plus.R
| woba_plus | R Documentation |
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.
woba_plus(df)
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. |
Returns a tibble with the wOBA factors calculated and the following columns:
| col_name | types | description |
| bbref_id | character | Baseball-Reference player id |
| season | integer | Season (4-digit year) |
| Name | character | Player name |
| Age | numeric | Player age |
| Level | character | Level of play (e.g. MLB or minor-league level) |
| Team | character | Team name |
| G | numeric | Games played |
| PA | numeric | Plate appearances |
| AB | numeric | At-bats |
| R | numeric | Runs scored |
| H | numeric | Hits |
| X1B | numeric | Singles |
| X2B | numeric | Doubles |
| X3B | numeric | Triples |
| HR | numeric | Home runs |
| RBI | numeric | Runs batted in |
| BB | numeric | Walks (bases on balls) |
| IBB | numeric | Intentional walks |
| uBB | numeric | Unintentional walks (BB minus IBB) |
| SO | numeric | Strikeouts |
| HBP | numeric | Hit by pitch |
| SH | numeric | Sacrifice hits (bunts) |
| SF | numeric | Sacrifice flies |
| GDP | numeric | Grounded into double plays |
| SB | numeric | Stolen bases |
| CS | numeric | Caught stealing |
| BA | numeric | Batting average |
| OBP | numeric | On-base percentage |
| SLG | numeric | Slugging percentage |
| OPS | numeric | On-base plus slugging |
| wOBA | numeric | Weighted on-base average (per plate appearance) |
| wOBA_CON | numeric | Weighted on-base average per instance of fair contact |
try({
df <- bref_daily_batter("2015-08-01", "2015-10-03")
woba_plus(df)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.