Learn R Programming

Sabermetrics (version 2.0)

era: Earned-Run Average (ERA)

Description

ERA is a basic metric used to describe a pitchers ability to prevent runs.

Usage

era(er, ip)

Arguments

er
Earned Runs
ip
Innings Pitched

Value

Returns a numerical value equal to (9*er)/ip

Details

ERA is not a perfect indicator of pitcher skill. It is highly defense dependent.

References

http://www.fangraphs.com/library/pitching/era/

See Also

whip,fip,xfip

Examples

Run this code
## Let's calculate Clayton Kershaw's ERA for the 2014 Season
## He had 39 ER's and 198.333 IP
## We should get an ERA = to 1.77
era(39,198.333)

## The function is currently defined as
function (er, ip) 
{
    era <- (9 * er)/ip
    return(era)
  }

Run the code above in your browser using DataLab