Learn R Programming

rlang (version 1.0.1)

env_clone: Clone an environment

Description

This creates a new environment containing exactly the same objects, optionally with a new parent. Active bindings and promises are preserved (the latter only on R >= 4.0.0).

Usage

env_clone(env, parent = env_parent(env))

Arguments

env

An environment.

parent

The parent of the cloned environment.

Examples

Run this code
# NOT RUN {
env <- env(!!! mtcars)
clone <- env_clone(env)
identical(env, clone)
identical(env$cyl, clone$cyl)
# }

Run the code above in your browser using DataLab