Make a copy of an environment with just the selected objects.
Source:R/formula.utilities.R
trim_env.RdMake a copy of an environment with just the selected objects.
Usage
trim_env(object, keep = NULL, ...)
# S3 method for class 'environment'
trim_env(object, keep = NULL, ...)
# Default S3 method
trim_env(object, keep = NULL, ...)Arguments
- object
An
environmentor an object withenvironment()andenvironment()<-methods.- keep
A character vector giving names of variables in the environment (including its ancestors) to copy over, defaulting to dropping all. Variables that cannot be resolved are silently ignored.
- ...
Additional arguments, passed on to lower-level methods.
Value
An object of the same type as object, with updated
environment. If keep is empty, the environment is baseenv();
if not empty, it's a new environment with baseenv() as parent.
Methods (by class)
trim_env(environment): A method for environment objects.trim_env(default): Default method, for objects such asformulaandfunctionthat haveenvironment()andenvironment()<-methods.