Skip to content

Instantly share code, notes, and snippets.

@cboettig
Created April 14, 2015 19:55
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 cboettig/415959a2523687a55366 to your computer and use it in GitHub Desktop.
Save cboettig/415959a2523687a55366 to your computer and use it in GitHub Desktop.
testing parallel dplyr::do
library("nycflights13")
library("dplyr")
library("mgcv")
by_dest <- flights %>% group_by(dest) %>% filter(n() > 100)
system.time(
by_dest %>% do(smooth = gam(arr_delay ~ s(dep_time) + month, data = .))
)
init_cluster(parallel::detectCores())
system.time(
by_dest %>% do(smooth = gam(arr_delay ~ s(dep_time) + month, data = .))
)
stop_cluster()
@cboettig
Copy link
Author

Note: dplyr::init_cluster() and friends now appear in the documentation: http://rpackages.ianhowson.com/cran/dplyr/man/dplyr-cluster.html but don't seem to be implemented in the do method at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment