Skip to content

Instantly share code, notes, and snippets.

@gghatano
Created January 10, 2014 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gghatano/8344555 to your computer and use it in GitHub Desktop.
Save gghatano/8344555 to your computer and use it in GitHub Desktop.
Create a pitting animation of Hisashi-Iwakuma (4/2/2013)
library(ggplot2)
library(lattice)
library(pitchRx)
library(plyr)
dat0402 <- scrapeFX(start="2013-04-02", end="2013-04-02")
pitches0402 <- plyr::join(dat0402$pitch, dat0402$atbat,
by = c("num", "url"),
type="inner")
iwakuma0402 <- subset(pitches0402, pitcher_name=="Hisashi Iwakuma")
iwakuma0402_FF_or_FS <- subset(iwakuma0402, pitch_type == "FF" | pitch_type == "FS")
animation::saveHTML({ animateFX(iwakuma0402_FF_or_FS, point.alpha = 0.8, layer = facet_grid(pitcher_name~stand)) })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment