Learn R Programming

rlang (version 1.1.2)

env_depth: Depth of an environment chain

Description

This function returns the number of environments between env and the empty environment, including env. The depth of env is also the number of parents of env (since the empty environment counts as a parent).

Usage

env_depth(env)

Value

An integer.

Arguments

env

An environment.

See Also

The section on inheritance in env() documentation.

Examples

Run this code
env_depth(empty_env())
env_depth(pkg_env("rlang"))

Run the code above in your browser using DataLab