Learn R Programming

Sabermetrics (version 2.0)

opsplus: OPS+

Description

A useful metric to describe a hitter's ability in terms of the league.

Usage

opsplus(obp, slg, lgOBP, lgSLG)

Arguments

obp
On-base percentage
slg
Slugging percentage
lgOBP
League OBP
lgSLG
League Slugging Percentage

Value

Returns a numerical value equal to ((obp/lgOBP)+(slg/lgSLG)-1)*100100 = League Average 90 = 10 percent BELOW League Average 110 = 10 percent ABOVE League Average

References

http://sports.yahoo.com/mlb/blog/big_league_stew/post/Everything-you-always-wanted-to-know-about-OPS-?urn=mlb,204667

http://www.fangraphs.com/library/offense/ops/

See Also

ops, slg, obp

Examples

Run this code
## Let's calculate Mike Trout's 2014 OPS+
## He had an OBP = .377 and a SLG = .561
## League OBP = .316 and League SLG = .404 
## We should get 158.1652 as our output
opsplus(.377,.561,.316,.404)

## The function is currently defined as
function (obp, slg, lgOBP, lgSLG) 
{
    opsplus <- ((obp/lgOBP) + (slg/lgSLG) - 1) * 100
    return(opsplus)
  }

Run the code above in your browser using DataLab