env_depth: Depth of an environment chain

View source: R/env.R

env_depthR Documentation

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)

Arguments

env

An environment.

Value

An integer.

See Also

The section on inheritance in env() documentation.

Examples

env_depth(empty_env())
env_depth(pkg_env("rlang"))

hadley/rlang documentation built on Nov. 1, 2024, 4 p.m.