make: Run R Script If Needed

View source: R/make.R

makeR Documentation

Run R Script If Needed

Description

Run an R script if underlying files have changed, otherwise do nothing.

Usage

make(recipe, prereq, target, include = TRUE, engine = source,
  debug = FALSE, force = FALSE, recon = FALSE, ...)

Arguments

recipe

script filename.

prereq

one or more underlying files, required by the script. For example, data files and/or scripts.

target

one or more output files, produced by the script. Directory names can also be used.

include

whether to automatically include the script itself as a prerequisite file.

engine

function to source the script.

debug

whether to show a diagnostic table of files and time last modified.

force

whether to run the R script unconditionally.

recon

whether to return TRUE or FALSE, without actually running the R script.

...

passed to engine.

Value

TRUE or FALSE, indicating whether the script was run.

Note

This function provides functionality similar to makefile rules, to determine whether a script should be (re)run or not.

If any target is missing or older than any prereq, then the script is run.

References

Stallman, R. M. et al. An introduction to makefiles. Chapter 2 in the GNU Make manual.

See Also

source runs any R script, source.taf is more convenient for running a TAF script, and source.all runs all TAF scripts.

make, make.taf, and make.all are similar to the source functions, except they avoid repeating tasks that have already been run.

TAF-package gives an overview of the package.

Examples

## Not run: 
make("model.R", "data/input.dat", "model/results.dat")

## End(Not run)


TAF documentation built on March 31, 2023, 6:51 p.m.