Skip to content
An R package enabling the computation of openWAR using MLBAM data
Branch: master
Clone or download
Latest commit 0b00a0e Jul 19, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
data-raw major under the hood update for R 3.3 May 11, 2016
data
inst
man
tests
vignettes
.Rbuildignore
.gitignore
.travis.yml cleanup after PR; close #105; close #31; close #102; close #106; close Oct 4, 2017
DESCRIPTION close #116 Jun 19, 2018
NAMESPACE Clean CRAN check! Added error handling to xml2df to prevent extra col… Sep 19, 2017
README initialization from existing code Jul 15, 2013
README.Rmd
README.md
openWAR.Rproj

README.md

OpenWAR

Travis-CI Build Status

An open-source system for computing Wins Above Replacement

This package is designed to present a reference implementation of Wins Above Replacement for Major League Baseball players.

Installation

The Sxslt package is required in order to download new game data from MLBAM. This package is not present on CRAN. Hence, some manual installation may be necessary. The following command:

devtools::install_github("omegahat/Sxslt")

should do the trick. If it doesn't please check that your operating system meets the SystemRequirements. These can be installed on Ubuntu by:

sudo apt-get install libxslt1-dev libxslt1.1 libxml2 libxml2-dev

Next, installing openWAR is best accomplished through the install_github function in the devtools package.

devtools::install_github("beanumber/openWAR")

Data Source

The gameday function downloads play-by-play data from the GameDay server hosted by Major League Baseball Advanced Media. This data is not libre, but it lives on a publicly-available webserver.

Getting individual game data is as simple as:

library(openWAR)
gd <- gameday()
## gid_2012_08_12_atlmlb_nynmlb_1
summary(gd)
##        Length Class        Mode     
## gameId  1     -none-       character
## base    1     -none-       character
## url     5     -none-       character
## ds     62     GameDayPlays list
plot(gd)

To retrieve a data.frame of many games worth, try:

ds <- getData()

This will retrieve play-by-play data for all games played yesterday (by default). For each play, 62 variables are recorded.

Methodology

Please see our full paper on the arXiv or in Journal of Quantitative Analysis in Sports.

You can’t perform that action at this time.