with_wd: Temporarily evaluate an expression in a directory

View source: R/utils.R

with_wdR Documentation

Temporarily evaluate an expression in a directory

Description

Temporarily evaluate an expression in a directory, then set the directory back to the original.

Usage

with_wd(dir, expr)

Arguments

dir

a directory to perform an expression within.

expr

expression to evaluate.

Details

See here: http://plantarum.ca/code/setwd-part2/

Author(s)

Tyler Smith, contributed to regionReport by David Robinson https://github.com/dgrtwo

Examples


## Create a directory called 'hola' and then check that it exists
with_wd(tempdir(), {
    dir.create("hola", showWarnings = FALSE)
    file.exists("hola")
})


LieberInstitute/sgejobs documentation built on Dec. 13, 2024, 11:20 p.m.