Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. ### --- Load pacakges (if necessary) --- ###
  2. library(dplyr, warn.conflicts = FALSE)
  3. library(ggplot2)
  4. library(xtable)
  5. library(descr)
  6.  
  7. ### --- Total number of pitches thrown during each game in 2013 --- ###
  8. pfx_16 %>%
  9. group_by(gameday_link) %>%
  10. summarize(N = length(call))
  11.  
  12. pfx_16 %>%
  13. group_by(gameday_link) %>%
  14. summarize(N = length(call)) %>%
  15. summarize(min = min(N), max = max(N), mean = mean(N), sd = sd(N))
  16.  
  17. ### --- Mean/SD number of pitches per game in 2013 --- ###
  18. msd_pitches <- pfx_16 %>%
  19. group_by(gameday_link) %>%
  20. summarize(N = length(call)) %>%
  21. summarize(mean = mean(N), sd = sd(N))
  22.  
  23. ### --- Mean/SD number of decisions per game in 2013 --- ###
  24. msd_decisions <- pfx_16 %>%
  25. group_by(gameday_link) %>%
  26. filter(call == "Called Strike" | call == "Ball") %>%
  27. summarize(N = length(call)) %>%
  28. summarize(min = min(N), max = max(N), mean = mean(N), sd = sd(N))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement