Creates a folder function for easy access to the directory, named by prepending a prefix specific to this package to the given name. If neither an explicit path not a pathVar holding the value to set is provided, then the given name will be treated as an option or environment variable name, and those locations will be searched for the value to be returned when the function created here is called.

setff(name, path = NULL, pathVar = NULL, postpend = NULL,
  loadEnvir = globalenv())

Arguments

name

An immutable key given to identify the current folder, and used as a string to create the new folder function

path

An absolute path to a folder that will be prepended when the specified folder function is called

pathVar

Name of the currently set variable whose value should be bound to name. First getOption is used, and then Sys.getenv.

postpend

Value(s) with which to make subpath relative to main path or value fetched from option or environment variable.

loadEnvir

An environment. Into which environment would you like to load the function? Defaults to globalenv. You can replace this with parent.frame to restrict the scope of created functions.

Value

A function named ff<name> that when executed without arguments points to the path and appends the provided argument to it if any were provided.

See also

See this vignette for more detailed explanation of the concept

Examples

setff("PROC", "/path/to/directory")
#> Created folder function ffPROC(): /path/to/directory