Learn R Programming

mlbstats (version 0.1.0)

ops: Calculates on-base plus slugging

Description

Computes the on-base percentage plus slugging average (OPS) based on number of hits, bases on balls, hits by pitch, at bats, sacrifice flies, and total weighted bases (represented individually, as in SLG and GPA calculations)

Usage

ops(h, bb, hbp, ab, sf, b1, b2, b3, hr)

Arguments

h

Number of hits

bb

Number of bases on balls

hbp

Number of hits by pitch

ab

Number of at bats

sf

Number of sacrifice flies

b1

Number of singles

b2

Number of doubles

b3

Number of triples

hr

Number of home runs

Value

ops

Examples

Run this code
# NOT RUN {
ops(200, 18, 4, 401, 4, 50, 20, 3, 13)
# }

Run the code above in your browser using DataLab