in_dir: Evaluate an expression under a specified working directory

View source: R/utils.R

in_dirR Documentation

Evaluate an expression under a specified working directory

Description

Change the working directory, evaluate the expression, and restore the working directory.

Usage

in_dir(dir, expr)

Arguments

dir

Path to a directory.

expr

An R expression.

Examples

library(xfun)
in_dir(tempdir(), {
    print(getwd())
    list.files()
})

xfun documentation built on Nov. 17, 2022, 1:06 a.m.