View source: R/run_covr_modes.R
| load_package_exports_into_env | R Documentation |
Copy exported objects (typically functions, but also exported constants or other objects) from one or more installed package namespaces into a target environment.
load_package_exports_into_env(pkg_names, env, overwrite = FALSE)
pkg_names |
Character vector of package names whose exported objects should be copied into 'env'. |
env |
Environment into which exported objects should be assigned. |
overwrite |
Logical; if 'TRUE', overwrite objects already present in 'env'. If 'FALSE' (default), existing objects are left unchanged. |
This is useful when evaluating code in an isolated environment, such as one created with 'new.env(parent = baseenv())', where package exports that are normally available on the search path (for example from 'stats' or 'utils') are not automatically visible.
The function does not attach packages to the search path. Instead, it copies exported objects directly into 'env'.
For each package in 'pkg_names', this function:
checks whether the package namespace is available,
retrieves the package's exported names,
obtains each exported object with 'getExportedValue()',
assigns the object into 'env'.
Packages that are not installed or cannot be loaded are skipped with a message.
A character vector of fully qualified object names that were loaded, in the form '"pkg::name"'.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.