getWAR: Compute each player's openWAR.

Description Usage Arguments Details Value Examples

Description

Tabulates each player's value of openWAR given either an object of class GameDayPlays or a list containing a data frame of class openWARPlays.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
getWAR(data, dataRepl = NULL, nteams = 30, verbose = TRUE, ...)

## S3 method for class 'GameDayPlays'
getWAR(data, dataRepl = NULL, nteams = 30,
  verbose = TRUE, ...)

## S3 method for class 'list'
getWAR(data, dataRepl = NULL, nteams = 30, verbose = TRUE,
  ...)

## S3 method for class 'openWARPlays'
getWAR(data, dataRepl = NULL, nteams = 30,
  verbose = TRUE, ...)

Arguments

data

An object of class 'openWARPlays'

dataRepl

An object of class 'openWARPlays' that will be used to calculate the replacement level.

nteams

The nteams argument to be passed to getReplacementPlayers

verbose

do you want information about how many replacement-level players there are?

...

currently ignored

Details

If an object of GameDayPlays is input to the function getWAR, the function makeWAR is called internally to first process the data, then getWAR tabulates the final values of openWAR for each player. Alternatively, the function makeWAR can be run separately and the output from this function can be passed to getWAR, which will complete the tabulation of openWAR. By default, the data set used to compute the replacement level is the same as the input data set. Using the dataRepl option a user can specify a separate data set of used solely to calculate the replacement level. This data set should be based on a full season of data and not a partial season. For in season, calculations, for instance, the data from the current year can be used to calculate openWAR, whereas the data from the previous full season can be used to compute the replacement level.

Value

An data.frame of class openWARPlayers

Examples

 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
## Not run: 
MayProcessed = makeWAR(May)
war = getWAR(MayProcessed)

## End(Not run)
#openWAR and replacement level calculated with the same data set
war = getWAR(MayProcessed)
#openWAR and replacement level calculated with the same data set
#Replacement level calculated as if there were only 27.5 major league teams
war = getWAR(MayProcessed, nteams = 27.5)
## Not run: 
#openWAR and replacement level calculated with the same data set
war = getWAR(MayProcessed)

## End(Not run)

## Not run: 
MayProcessed = makeWAR(May)

## End(Not run)
#openWAR and replacement level calculated with the same data set
war = getWAR(MayProcessed)  

## Not run: 
MayProcessed = makeWAR(May)

## End(Not run)
#openWAR and replacement level calculated with the same data set
war <- getWAR(MayProcessed$openWAR)
#Use different data for calculating openWAR and replacement level  
war <- getWAR(MayProcessed$openWAR, dataRepl = head(MayProcessed$openWAR, 10000))

beanumber/openWAR documentation built on May 12, 2019, 9:43 a.m.