# NOT RUN {
if(requireNamespace("parallel", quietly = TRUE)) {
cl <- parallel::makeCluster(2)
d <- data.frame(x = 1:5, g = c(1, 1, 2, 2 ,2))
f <- function(dl) {
d <- dl$d
d$s <- sqrt(d$x)
d
}
r <- execute_parallel(list(d = d), f,
partition_column = "g",
cl = cl) %.>%
do.call(rbind, .) %.>%
print(.)
parallel::stopCluster(cl)
}
# }
Run the code above in your browser using DataLab