## Let's calculate Mike Trout's SLG for the 2014 season
## He had 338 TB's and 602 AB's
## We should get .561 as our output
slg(338,602)
## The function is currently defined as
function (TB, AB)
{
slugging <- (TB/AB)
return(slugging)
}
Run the code above in your browser using DataLab