Skip to contents

Returns the configured output directory or constructs a path to a file within it. The output directory is set through the option pharos.outDir.

Usage

outDir(filename = NULL)

Arguments

filename

Optional file name, or relative path within the output directory. If NULL, the output directory itself is returned.

Value

A character string containing the normalized output directory or, if filename is supplied, the corresponding file path.

Details

This is useful for analysis scripts that create multiple figures or other output files: the output location can be defined once at the beginning of the script and individual functions only need to specify the file name.

The configured directory must exist. outDir() does not create directories.

Examples

if (FALSE) { # \dontrun{
options(pharos.outDir = "O:/project/graphics")

outDir()
outDir("Figure 1")

plot(1:10) |>
  exportPlot(file = outDir("Figure 1"), width = 20, height = 12)
} # }