## The isolated power (iso) function is currently defined as
function (slg, avg)
{
iso <- slg - avg
return(iso)
}
## Let's take 2014's MLB MVP, Mike Trout, and find his Isolated Power
## Stats for Mike Trout available on
## http://www.baseball-reference.com/players/t/troutmi01-bat.shtml
## For 2014, Trout had a SLG of .561 and an AVG of .287
## The formula for his Isolated Power using the iso function is below
## Output should be .274
iso(0.561,0.287)
Run the code above in your browser using DataLab