4.3 Rate Statistics
In baseball statistics, consider the use of both count statistics and rate statistics
- count statistics (for example): \(AB\), \(ER\), \(H\), \(IP\)
- rate statistics (for example):
\[BA = \frac{H}{AB}, \quad ERA = \frac{ER}{IP} \cdot 9\]
4.3.1 Win Percentage
ch4_data <- Teams |>
filter(yearID >= 1998, yearID != 2020) |>
select(yearID, lgID, teamID, G, W, L, R, RA, DivWin, WCWin) |>
# run differential
mutate(RD = R - RA) |>
# win percentage
mutate(Wpct = W / (W + L)) |>
# playoff win (Boolean)
mutate(playoff_bool = ifelse(
DivWin == "Y" | WCWin == "Y",
"made playoffs", "missed playoffs"
))