Branch Between Alternative Paths

Create a multiplexed graph.

branch(..., .graphs = NULL, .prefix_branchops = "",
  .prefix_paths = FALSE)

Multiple graphs, possibly named. They all must have exactly one output. If any of the arguments are named, then all must have unique names.


([list of Graph]): Named list of Graphs, additionally to the graphs given in ....


([character(1)]): Optional id prefix to prepend to PipeOpBranch and PipeOpUnbranch id. Their resulting IDs will be "[.prefix_branchops]branch" and "[.prefix_branchops]unbranch". Default is "".


([logical(1) | character(1)]): Whether to add prefixes to graph IDs when performing gunion. Can be helpful to avoid ID clashes in resulting graph. Default FALSE. If this is TRUE, the prefixes are taken from the names of the input arguments if present or "poX" where X counts up. If this is a character(1), it is a prefix that is added to the PipeOp IDs additionally to the input argument list.

  • branch

po_pca = po("pca")
po_nop = po("nop")

branches = branch(pca = po_pca, nothing = po_nop)
# gives the same as
branches = c("pca", "nothing")
po("branch", branches) %>>%
  gunion(list(po_pca, po_nop)) %>>%
  po("unbranch", branches)

branch(pca = po_pca, nothing = po_nop,
  .prefix_branchops = "br_", .prefix_paths = "xy_")
# gives the same as
po("branch", branches, id = "br_branch") %>>%
  gunion(list(xy_pca = po_pca, xy_nothing = po_nop)) %>>%
  po("unbranch", branches, id = "br_unbranch")
# }
Documentation reproduced from package mlr3pipelines, version 0.1.1, License: LGPL-3

Community examples

Looks like there are no examples yet.