Function that crawls a set of environments to search for user environments defined within each of them.
crawl_envs(env_names, path, path_to_envs_found, rootenvir = NULL)
array with the environment names where the search for environments is wished (careful: should not contain the environment *objects* but their *names*!).
array with user environment names leading to the current set of
environments listed in env_names
. Ex: c("env_of_envs", "env11")
which means that the
the environments listed in env_names
exist in environment env_of_envs$env11
.
array of user environment names found so far including their path
where the path is allowed to include ONLY user environments.
(e.g. an element of the path_to_envs_found
array could be "env1$env2$env"
, but NOT
"R_GlobalEnv$env1$env2"
, because "R_GobalEnv" is the name of a system environment, NOT a
user environment).
The first time this function is called it should contain the empty array.
environment used as starting point for the user environment
search process. If NULL
, the environment is taken from the names attribute of
the env_names
parameter.
An array containing the path to each user environment found inside the rootenvir
environment and all the nested user environments found within each of them.
This array is concatenated to whatever paths are already listed in the path_to_envs_found
parameter passed to the function.
This function crawls the user environments defined in the rootenvir
environment and
any user environments within those user environments until no user environment
has been left without visit, making up a tree of nested user environments.
The path to each user environment found is stored using the $
notation as in
env1$env12$envx
.
Instead of setting the rootenvir
parameter to the root environment where the search should start,
a similar result is obtained by setting the path
variable to the environment chain leading to
the environments passed in env_names
, as in e.g. c("env_of_envs", "env11")
.
The difference is that such environment will appear as part of the paths to the environments passed,
and in addition, it is assumed that such environment is an actual environment.