Created
April 5, 2017 20:26
-
-
Save benfb/d4c85ba9aac3ad8d5e0c3304eb2d696a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(baseballr) | |
library(dplyr) | |
bryant <- scrape_statcast_savant_batter(start_date = "2016-04-03", end_date = "2016-10-03", batterid = 592178) | |
bryant_reds <- bryant %>% | |
mutate(reds = away_team == "CIN" | home_team == "CIN") %>% | |
group_by(reds) %>% | |
summarize( | |
avg_launchangle = mean(as.numeric(as.character(hit_angle)), na.rm = TRUE), | |
avg_hitspeed = mean(hit_speed, na.rm = TRUE), | |
avg_hitdistance = mean(hit_distance_sc, na.rm = TRUE), | |
barrel_freq = mean(barrel, na.rm = TRUE) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment