Learn R Programming

SpaDES.core (version 2.0.5)

setPaths: Get and set default working directories

Description

Wrapper functions to access the packages options for default working directories. Note: there is an active binding made to Paths, so a user can use Paths$cachePath for example instead of getPaths()$cachePath

Usage

.paths()

getPaths()

Paths

setPaths( cachePath, inputPath, modulePath, outputPath, rasterPath, scratchPath, terraPath, silent = FALSE )

Value

getPaths returns a named list of the user's default working directories. setPaths is invoked for the side effect of setting these directories.

Format

An object of class list of length 7.

Arguments

cachePath

The default local directory in which to cache simulation outputs. If not specified, defaults to getOption("reproducible.cachePath").

inputPath

The default local directory in which to look for simulation inputs If not specified, defaults to getOption("spades.inputPath").

modulePath

The default local directory where modules and data will be downloaded and stored. If not specified, defaults to getOption("spades.modulePath").

outputPath

The default local directory in which to save simulation outputs. If not specified, defaults to getOption("spades.outputPath").

rasterPath

The default local directory in which to save transient raster files. If not specified, defaults to file.path(getOption("spades.scratchPath"), "raster"). Important note: this location may not be cleaned up automatically, so be sure to monitor this directory and remove unnecessary temp files that may contribute to excessive disk usage. This option will be deprecated in a future release.

scratchPath

The default local directory in which to save transient files. If not specified, defaults to getOption("spades.scratchPath"). Important note: this location may not be cleaned up automatically, so be sure to monitor this directory and remove unnecessary temp files that may contribute to excessive disk usage.

terraPath

The default local directory in which to save transient terra files. If not specified, defaults to file.path(getOption("spades.scratchPath"), "terra"). Important note: this location may not be cleaned up automatically, so be sure to monitor this directory and remove unnecessary temp files that may contribute to excessive disk usage.

silent

Logical. Should the messaging occur.

Author

Alex Chubaty

Examples

Run this code
# \donttest{
getPaths()                       ## returns the current default working paths

## set individual custom paths
setPaths(cachePath = file.path(tempdir(), "cache"))
setPaths(inputPath = file.path(tempdir(), "inputs"))
setPaths(modulePath = file.path(tempdir(), "modules"))
setPaths(outputPath = file.path(tempdir(), "outputs"))
setPaths(scratchPath = file.path(tempdir(), "scratch"))

# NOTE: on loading and attaching SpaDES.core,
# an active binding is made to "Paths"

getPaths()
Paths ## same as getPaths() above
setPaths(outputPath = tempdir())
Paths # shows change
# }

Run the code above in your browser using DataLab