Learn R Programming

Sabermetrics (version 2.0)

secavg: Secondary Average

Description

Secondary average measure the sum of extra bases gained on hits, walks and stolen bases.

Usage

secavg(ab, bb, tb, h, sb, cs)

Arguments

ab
At Bats
bb
Walks
tb
Total Bases
h
Hits
sb
Stolen Bases
cs
Caught Stealing

Value

Returns a numerical value equal to (bb+tb-h+sb-cs)/ab

Details

SecAvg shares no correlation with batting average although overall league averages are inclined to correspond with league batting averages.

References

https://en.wikipedia.org/wiki/Secondary_average

See Also

ops,slg,iso

Examples

Run this code

## The function is currently defined as
function (ab, bb, tb, h, sb, cs) 
{
    SecA <- (bb + tb - h + sb - cs)/ab
    return(SecA)
  }

Run the code above in your browser using DataLab