Description Usage Arguments Details Value Examples
These functions complete various tasks related to directory structure and inclusion of a path variable in many of the functions throughout the package.
1 2 3 4 | check_path(x, env = parent.frame(), sub_dir_only = FALSE,
ignore_subdir = FALSE)
check_dir_exists(dir = NULL, recursive = FALSE)
|
x |
Character. Name of file |
env |
An environment to search for the object named |
sub_dir_only |
Logical. Only paste the sub-directory path when
|
ignore_subdir |
Logical. Only paste the path without the sub-directory
when |
dir |
Character. The name of a directory to look for (and create if not found) |
check_path looks for an object named path in the environment
specified by env and attaches it in front of x separated by
a "/". check_dir_exists checks to see if a directory exists, and, if
not, makes one in directory specified by path.
Both check_path and check_dir_exists will recognize either a
character vector as path or an object of class gadget_sub_dir. If path
is the latter, then some special characters can also be utilized. These are
of the most use when writing likelihood and data files to sub-directories of
a Gadget model (for instance, when running multiple replications of a
simulation model are desired for testing purposes).
check_path returns a character of either the x or the
path and x pasted if path exists in the environment
env. If path is an object of class gadget_sub_dir
then a character of either the path and sub-dir (default), or x pasted
with sub-directory (sub_dir_only = TRUE), or x pasted with
only the path and sub-directory not included (ignore_subdir = TRUE).
These are of use when writing likelihood aggfiles and data files in sub-
directories. check_dir_exists returns nothing. It searches for the
directory dir within path if it exists and creates a
directory named dir if it is not found
1 2 3 4 5 6 7 8 9 | check_path("main")
path <- "test_dir"
check_path("main")
## Not run:
check_dir_exists("foo")
check_dir_exists("bar")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.