Introduction to openWAR Package, Part 1
Ben Baumer and Greg Matthews have a relatively new R package
openWAR that facilitates calculation of WAR based on methodology from their recently published paper in the Journal of Quantitative Analysis of Sports. See their github site for a description of installing the package.
One attractive feature of the
openWAR package is that it allows for downloading of MLBAM GameDay play-by-play data. Recently, I illustrated the use of the
retrosheet package to download similar data from Retrosheet. We’ll see that the data frames that we get from MLBAM GameDay contain many more variables that facilitate developing interesting analysis.
In this post, I illustrate the downloading of play-by-play data, illustrate run expectancy calculations, and use the MLBAM GameDay data to show the locations of all in-play events for specific players.
Downloading MLBAM data
Once you have loaded the
openWAR package, downloading data is remarkably easy. For example, to download all GameDay…
View original post 567 more words