## Let's calculate Mike Trout's 2014 wRC
## He had a wOBA of .402 and 705 PA's
## We should return 125.879
wrc(.402,705,2014)
## The function is currently defined as
function (wOBA, PA, year)
{
wrc <- (((wOBA - linearWeights$wOBA[which(linearWeights$Season ==
year)])/linearWeights$wOBAScale[which(linearWeights$Season ==
year)]) + weights$RPerPA[which(linearWeights$Season ==
year)]) * PA
return(wrc)
}
Run the code above in your browser using DataLab