runInTempDir: Run Expression In a Temporary Directory

Description Usage Arguments Value Note Examples

Description

Run Expression In a Temporary Directory

Usage

1
runInTempDir(expr, temp_dir = tempdir(), prefix = "temp")

Arguments

expr

Expression to be evaluated in a temporary directory.

temp_dir

Optional. Path to temporary main directory. Default tempdir()

prefix

Optional. String that will be used as prefix for the temporary subfolder.

Value

Returns invisibly the last value evaluated in the expression.

Note

Working directory will be change to temporary subfolder. Once the evaluation of the expression is finished, the working directory will be restored and the temporary subfolder (with its contents) will be deleted. The temporary main directory will remain untouched.

Examples

1
2
temp_wd = runInTempDir({getwd()})
temp_wd

fabarca/reutiles documentation built on May 16, 2019, 9:57 a.m.