Skip to content

Instantly share code, notes, and snippets.

HardHit = colDef(
align = "left",
cell = function(value, index) {
votes <- ratings$ABs[index]
BB <- ratings$BB[index]
stars <- lapply(seq_len(votes), function(i)
{
if (i <= value) star_icon() else x_icon(empty = FALSE)
})
label <- sprintf("%s out of %s", stars, votes)
library(dplyr)
pbp = Statcast
pbp$runs = stringr::str_count(pbp$des,'scores') + ifelse(pbp$events == 'home_run',1,0)
pbp$inning_id = paste0(pbp$game_pk, pbp$inning, pbp$inning_topbot)
pbp = pbp %>%
group_by(inning_id) %>%