make_with_source {makepipe}R Documentation

Make targets out of dependencies using a source file

Description

Make targets out of dependencies using a source file

Usage

make_with_source(
  source,
  targets,
  dependencies = NULL,
  packages = NULL,
  envir = new.env(parent = parent.frame()),
  quiet = getOption("makepipe.quiet"),
  force = FALSE,
  label = NULL,
  note = NULL,
  ...
)

Arguments

source

The path to an R script which makes the targets

targets

A character vector of paths to files

dependencies

A character vector of paths to files which the targets depend on

packages

A character vector of names of packages which targets depend on

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

force

A logical determining whether or not execution of the source or recipe will be forced (i.e. happen whether or not the targets are out-of-date)

label

A short label for the source or recipe, displayed in pipeline visualisations. If NULL, the basename(source) or 'Recipe' will be used.

note

A description of what the source does, displayed in pipeline visualisations

...

Additional parameters to pass to base::source()

Value

A Segment object containing execution metadata.

See Also

Other make: make_with_dir(), make_with_recipe()

Examples

## Not run: 
# Merge files in fresh environment if raw data has been updated since last
# merged
make_with_source(
  source = "merge_data.R",
  targets = "data/merged_data.Rds",
  dependencies = c("data/raw_data.Rds", "data/raw_pop.Rds")
)


# Merge files in current environment if raw data has been updated since last
# merged. (If source executed, all objects bound in source will be available
# in current env).
make_with_source(
  source = "merge_data.R",
  targets = "data/merged_data.Rds",
  dependencies = c("data/raw_data.Rds", "data/raw_pop.Rds"),
  envir = environment()
)


# Merge files in global environment if raw data has been updated since last
# merged. (If source executed, all objects bound in source will be available
# in global env).
make_with_source(
  source = "merge_data.R",
  targets = "data/merged_data.Rds",
  dependencies = c("data/raw_data.Rds", "data/raw_pop.Rds"),
  envir = globalenv()
)

## End(Not run)


[Package makepipe version 0.2.1 Index]