RunCmdForNewerInput: Run a command if input files are newer than outputs

View source: R/make.r

RunCmdForNewerInputR Documentation

Run a command if input files are newer than outputs

Description

Run a command if input files are newer than outputs

Usage

RunCmdForNewerInput(
  cmd,
  infiles,
  outfiles,
  Verbose = FALSE,
  UseLock = FALSE,
  Force = FALSE,
  ReturnInputTimes = FALSE,
  ...
)

Arguments

cmd

An expression, a string or NA/NULL

infiles

Character vector of path to one or more input files

outfiles

Character vector of path to one or more output files

Verbose

Write information to consolse (Default FALSE)

UseLock

Stop other processes working on this task (Default FALSE)

Force

Ignore file modification times and always produce output if input files exist.

ReturnInputTimes

Return mtimes of input files (default FALSE)

...

additional parameters passed to system call.

Details

cmd can be an R expression, which is evaluated if necessary in the environment calling RunCmdForNewerInput, a string to be passed to system or NULL/NA in which cases the files are checked and TRUE or FALSE is returned depending on whether action is required.

When UseLock=TRUE, the lock file created is called outfiles[1].lock

When ReturnInputTimes=TRUE, the input mtimes are returned as an attribute of a logical value (if available).

Value

logical indicating if cmd was run or for an R expression, eval(cmd)

See Also

makelock, eval, expression

Examples

## Not run: 
RunCmdForNewerInput(expression(myfunc("somefile")))

## End(Not run)

jefferis/nat.utils documentation built on July 6, 2023, 4:42 p.m.