Learn R Programming

multidplyr (version 0.0.0.9000)

objman: Object management

Description

If cluster_assign_expr fails on one node, successfully created objects will be automatically deleted on all the other nodes.

Usage

cluster_assign_expr(cluster, name, expr)

cluster_assign_value(cluster, name, value)

cluster_assign_each(cluster, name, values)

cluster_copy(cluster, obj)

cluster_get(cluster, name)

cluster_rm(cluster, name)

cluster_ls(cluster)

Arguments

cluster

Cluster to work on

name

Name of variable as string.

value, values, expr

There are three ways to do assignment: you can set name to the same value on every node, you can set name to each of values, or you can evaluate expr once on each code.

obj

An existing object to copy to the cluster.

Value

cluster_assign_value, cluster_assign_each, cluster_assign_expr, and cluster_rm all (invisibly) return the cluster so they can be chained together.

cluster_ls and cluster_get return lists with one element for each node.

Examples

Run this code
# NOT RUN {
cl <- create_cluster(2)
cl %>%
  cluster_assign_value("x", 10) %>%
  cluster_get("x")

cl %>%
  cluster_assign_expr("y", quote(runif(2))) %>%
  cluster_get("y")

cl %>%
  cluster_assign_each("z", list(3, 4)) %>%
  cluster_get("z")

a <- 1:10
cl %>%
  cluster_copy(a) %>%
  cluster_get("a")

cl %>% cluster_ls()
cl %>% cluster_rm(c("a", "x", "y", "z"))
cl %>% cluster_ls()
# }

Run the code above in your browser using DataLab