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(),
failFunction = stop
)
An immutable key given to identify the current folder, and used as a string to create the new folder function
An absolute path to a folder that will be prepended when the specified folder function is called
Name of the currently set variable whose value should
be bound to name
. First getOption
is used, and then
Sys.getenv
.
Value(s) with which to make subpath relative to main path
or value fetched from option or environment variable.
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.
A function to call upon failure. Defaults to
stop
, but you could instead pass warning
if you are OK with
failures.
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 this vignette for more detailed explanation of the concept
# NOT RUN {
setff("PROC", "/path/to/directory")
# }
Run the code above in your browser using DataLab