forked from beanumber/openWAR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
57 lines (38 loc) · 1.89 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: "OpenWAR"
output:
github_document:
html_preview: true
---
[![Travis-CI Build Status](https://travis-ci.org/beanumber/openWAR.svg?branch=master)](https://travis-ci.org/beanumber/openWAR)
### An open-source system for computing Wins Above Replacement
This package is designed to present a reference implementation of [Wins Above Replacement](http://en.wikipedia.org/wiki/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:
```{r, eval=FALSE}
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:
```{bash, eval=FALSE}
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.
```{r, eval=FALSE}
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:
```{r}
library(openWAR)
gd <- gameday()
summary(gd)
plot(gd)
```
To retrieve a `data.frame` of many games worth, try:
```{r, eval=FALSE}
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](http://arxiv.org/abs/1312.7158) or in [*Journal of Quantitative Analysis in Sports*](https://www.degruyter.com/view/j/jqas.2015.11.issue-2/jqas-2014-0098/jqas-2014-0098.xml).