tidyverse / multidplyr

A dplyr backend that partitions a data frame over multiple processes
https://multidplyr.tidyverse.org
Other
641 stars 75 forks source link

Utility function for attaching functions? #22

Closed Mullefa closed 7 years ago

Mullefa commented 8 years ago

(probably) dubious implementation, but something like:

cluster_assign_func <- function(cl, f) {
  fname <- as.character(substitute(f))
  stopifnot(is.function(f))
  cluster_assign_value(cl, fname, f)
}
julou commented 8 years ago

I find it indeed useful… I also derived the following to attach any object:

cluster_assign_obj <- function(cl, x) {
  name <- as.character(substitute(x))
  stopifnot(exists(name))
  cluster_assign_value(cl, name, x)
}
cboettig commented 8 years ago

:+1: @Mullefa thanks for the implementation. Given that parallelizing do() over a complex function call is probably one of the more promising use cases, a utility function like this would be great.

hadley commented 7 years ago

Implemented as cluster_copy