cluster_call | R Documentation |

'cluster_call()' executes the code on each worker and returns the results; 'cluster_send()' executes the code ignoring the result. Jobs are submitted to workers in parallel, and then we wait until they're complete.

```
cluster_call(cluster, code, simplify = FALSE, ptype = NULL)
cluster_send(cluster, code)
```

`cluster` |
A cluster. |

`code` |
An expression to execute on each worker. |

`simplify` |
Should the results be simplified from a list? * 'TRUE': simplify or die trying. * 'NA': simplify if possible. * 'FALSE': never try to simplify, always leaving as a list. 'code' must return a vector of length one in order for simplification to succeed. |

`ptype` |
If 'simplify' is 'TRUE', use 'ptype' to enforce the desired output type. |

A list of results with one element for each worker in 'cluster'.

```
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)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.