Learn R Programming

baseballr (version 0.8.6)

run_expectancy_code: Generate run expectancy and related measures and variables from Baseball Savant data

Description

These functions allow a user to generate run expectancy and related measures and variables from Baseball Savant data. Measures and variables will be added to the data frame and a run expectancy table will be assigned to the Global Environment.

Usage

run_expectancy_code(df, level = "plate appearance")

Arguments

df

A data frame generated from Baseball Savant.

level

Whether you want run expectancy calculated at the plate appearance or pitch level. Defaults to plate appearance.

Examples

Run this code
# NOT RUN {
run_expectancy_code(df, level = "plate appearances")
# }

Run the code above in your browser using DataLab