Learn R Programming

Sabermetrics (version 2.0)

ops: On-Base Plus Slugging

Description

A metric that protrays a hitter's ability to get on base and to hit for power.

Usage

ops(slg, obp)

Arguments

slg
Slugging Percentage
obp
On-Base Percentage

Value

Returns a numerical value equal to (OBP)+(SLG)

References

http://www.fangraphs.com/library/offense/ops/ https://en.wikipedia.org/wiki/On-base_plus_slugging

See Also

opsplus, obp

Examples

Run this code
## 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