cl <- default_cluster()
# Run code on each cluster and retrieve results
cluster_call(cl, Sys.getpid())
cluster_call(cl, runif(1))
# use ptype to simplify
cluster_call(cl, runif(1), simplify = TRUE)
# use cluster_send() to ignore results
cluster_send(cl, x <- runif(1))
cluster_call(cl, x, simplify = TRUE)
Run the code above in your browser using DataLab