sourceTAF: Run TAF Script

Description Usage Arguments Details Value Note See Also Examples

View source: R/sourceTAF.R

Description

Run a TAF script and return to the original directory.

Usage

1
2
sourceTAF(script, rm = FALSE, clean = TRUE, detach = FALSE, taf = NULL,
  quiet = FALSE)

Arguments

script

script filename.

rm

whether to remove all objects from the global environment before and after the script is run.

clean

whether to clean the target directory before running the script.

detach

whether to detach all non-base packages before running the script, to ensure that the script is not affected by packages that may have been attached outside the script.

taf

a convenience flag where taf = TRUE sets rm, clean, and detach to TRUE, as is done on the TAF server. Any other value of taf is ignored.

quiet

whether to suppress messages reporting progress.

Details

The default value of rm = FALSE is to protect users from accidental loss of work, but the TAF server always runs with rm = TRUE to make sure that only files, not objects in memory, are carried over between scripts.

Likewise, the TAF server runs with clean = TRUE to make sure that the script starts with a clean directory. The target directory of a TAF script has the same filename prefix as the script: data.R creates ‘data’ etc.

Value

TRUE or FALSE, indicating whether the script ran without errors.

Note

Commands within a script (such as setwd) may change the working directory, but sourceTAF guarantees that the working directory reported by getwd() is the same before and after running a script.

See Also

source is the base function to run R scripts.

makeTAF runs a TAF script if needed.

sourceAll runs all TAF scripts in a directory.

TAF-package gives an overview of the package.

Examples

1
2
3
4
5
6
7
## Not run: 
write("print(pi)", "script.R")
source("script.R")
sourceTAF("script.R")
file.remove("script.R")

## End(Not run)

TAF documentation built on April 7, 2021, 5:06 p.m.