useResultsDir: Make a directory for results.

View source: R/projects.R

useResultsDirR Documentation

Make a directory for results.

Description

Make a directory for results.

Usage

useResultsDir(base, dir, rerun = FALSE)

Arguments

base

The base directory to create a results directory in. Will be created (recursively) if needed, unless rerun= TRUE is set. May be absolute or relative.

dir

The results directory under ⁠base=⁠ to be created (recursively). Must not exist unless rerun= TRUE is set. Must be relative to ⁠base=⁠.

rerun

Set TRUE to reuse an existing run directory; it must already exist.

Value

The path to the created (or existing) output directory, ⁠<base>/<outDir>⁠.

Examples

baseDir <- tempfile()
outDirName <- "run-1"
dir.exists( file.path( baseDir, outDirName )) == FALSE
myOutDir <- useResultsDir( baseDir, outDirName )
dir.exists( file.path( baseDir, outDirName )) == TRUE
useResultsDir( baseDir, outDirName, rerun=TRUE ) == myOutDir


jefferys/JefferysRUtils documentation built on Jan. 12, 2024, 9:18 p.m.