setff: Creator of function to reference project path.

Description Usage Arguments Value See Also Examples

View source: R/folderfun.R

Description

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.

Usage

1
2
3
4
5
6
7
8
setff(
  name,
  path = NULL,
  pathVar = NULL,
  postpend = NULL,
  loadEnvir = globalenv(),
  failFunction = stop
)

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.

failFunction

A function to call upon failure. Defaults to stop, but you could instead pass warning if you are OK with failures.

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

1
setff("PROC", "/path/to/directory")

folderfun documentation built on July 18, 2020, 9:06 a.m.