Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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)

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"))

rlang

Functions for Base Types and Core R and 'Tidyverse' Features

v0.4.11
MIT + file LICENSE
Authors
Lionel Henry [aut, cre], Hadley Wickham [aut], mikefc [cph] (Hash implementation based on Mike's xxhashlite), Yann Collet [cph] (Author of the embedded xxHash library), RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.