## This is a generic runs created formula
## Let's see how many runs created (keep in mind this is an estimate) ## a batter will make with
## 100 hits, 7 walks (BB), 80 total bases, and 300 at bats
function (H, BB, TB, AB)
{
rc <- ((H + BB) * TB)/(AB + BB)
return(rc)
}
rcBasic(100,7,80,300) # Should output 27.88274 runs
Run the code above in your browser using DataLab