Instead of maintaining a separate pipeline script containing calls to make_with_source(), you can add roxygen-like headers to the .R files in your pipeline containing the @makepipe tag along with @targets, @dependencies, and so on. These tags will be parsed by make_with_dir() and used to construct a pipeline. You can call a specific part of the pipeline that has been documented in this way using make_with_roxy().

make_with_dir(
  dir = ".",
  recursive = FALSE,
  build = TRUE,
  envir = new.env(parent = parent.frame()),
  quiet = getOption("makepipe.quiet")
)

make_with_roxy(
  source,
  envir = new.env(parent = parent.frame()),
  quiet = getOption("makepipe.quiet")
)

Arguments

dir

A character vector of full path names; the default corresponds to the working directory

recursive

A logical determining whether or not to recurse into subdirectories

build

A logical determining whether or not the pipeline will be built immediately or simply returned to the user

envir

The environment in which to execute the source or recipe. By default, execution will take place in a fresh environment whose parent is the calling environment.

quiet

A logical determining whether or not messages are signaled

source

The path to an R script which makes the targets

Value

A Pipeline object

Details

Other than @makepipe, which is used to tell whether a given script should be included in the pipeline, the tags recognised mirror the arguments to make_with_source(). In particular,

  • @targets and @dependencies are for declaring inputs and outputs, the expected format is a comma separated list of strings like @targets "out1.Rds", "out2.Rds" but R code like @targets file.path(DIR, "out.Rds") (evaluated in envir) works too

  • @packages is for declaring the packages that the targets depend on, the expected format is @packages pkg1 pkg2 etc

  • @force is for declaring whether or not execution should be forced, the expected format is a logical like TRUE or FALSE

See the getting started vignette for more information.

See also

Examples

if (FALSE) {
# Create a pipeline from scripts in the working dir without executing it
p <- make_with_dir(build = FALSE)
p$build() # Then execute it yourself
}