## 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