# NOT RUN {
# The following copies the output of 'scale' automatically to both
# 'pca' and 'nop'
po("scale") %>>%
gunion(list(
po("pca"),
po("nop")
))
# The following would not work: the '%>>%'-operator does not know
# which output to connect to which input
# > gunion(list(
# > po("scale"),
# > po("select")
# > )) %>>%
# > gunion(list(
# > po("pca"),
# > po("nop"),
# > po("imputemean")
# > ))
# Instead, the 'copy' operator makes clear which output gets copied.
gunion(list(
po("scale") %>>% mlr_pipeops$get("copy", outnum = 2),
po("select")
)) %>>%
gunion(list(
po("pca"),
po("nop"),
po("imputemean")
))
# }
Run the code above in your browser using DataCamp Workspace