Learn R Programming

Sabermetrics (version 2.0)

wraa: Weighted Runs Above Average

Description

wRAA measure the number of offensive runs a player contributes compared to an average player.

Usage

wraa(woba, year, PA)

Arguments

woba
Weighted On Base Percentage. See woba
year
Season
PA
Plate Appearances

Value

Returns a value equal to ((wOBA - league wOBA) / wOBA scale) x PA

Details

wRAA is league adjusted, meaning you can use it to compare players from different leagues and years.

References

http://www.fangraphs.com/library/offense/wraa/

See Also

woba

Examples

Run this code
## Let's calculate Mike Trout's 2014 wRAA
## He had a wOBA of .402 and 705 PA's
## We should return 49.74
wraa(.402,2014,705)

## The function is currently defined as
function (woba, year, PA) 
{
    wraa <- ((woba - linearWeights$wOBA[which(linearWeights$Season == 
        year)])/weights$wOBAScale[which(linearWeights$Season == 
        year)]) * PA
    return(wraa)
  }

Run the code above in your browser using DataLab