Last active
February 25, 2016 21:13
-
-
Save jeroen/fa60515cd84dd1ce6e61 to your computer and use it in GitHub Desktop.
This file contains hidden or 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(magrittr) | |
library(dplyr) | |
library(nycflights13) | |
library(evaluate) | |
library(ggplot2) | |
# Define the plot | |
makeplot <- function(mydata){ | |
date <- as.Date(paste("2013", mydata[1,"month"], mydata[1,"day"], sep="-")) | |
ggplot(mydata, aes(distance, arr_delay)) + | |
geom_point() + geom_smooth(se = FALSE) + | |
xlim(0, 3000) + ylim(0, 500) + | |
xlab("Distance") + ylab("Delay") + | |
ggtitle(format(date, "%A, %B %d, %Y")) | |
} | |
# Render and store the plots | |
sub_plots <- flights %>% | |
filter(!is.na(distance), !is.na(arr_delay)) %>% | |
group_by(month, day) %>% | |
do(plot = evaluate("makeplot(.)", keep_warning=FALSE)[[3]]) | |
# Play animation in rstudio | |
sub_plots %>% do(out = {print(.$plot); Sys.sleep(.10)}) |
Scratch that. Runs when I also have CRAN version of ggplot2. It does however seem to get stuck at 77% of the first "do" on my machine.
Same here - process get stuck at some point.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
github version of dplyr results in:
for the grouping step.
CRAN version gives:
for the first do step.