## Let's calculate Mike Trout's OPS for the 2014 season
## He had an OBP = .377 and a SLG = .561
## We should get .938 as our output
ops(.561,.377)
## The function is currently defined as
function (slg, obp)
{
ops <- slg + obp
return(ops)
}
Run the code above in your browser using DataLab