xfun (version 0.43)

in_dir: 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

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

Run the code above in your browser using DataLab