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

vec_depth

Compute the depth of a vector


Description

The depth of a vector is basically how many levels that you can index into it.

Usage

vec_depth(x)

Arguments

x

A vector

Value

An integer.

Examples

x <- list(
  list(),
  list(list()),
  list(list(list(1)))
)
vec_depth(x)
x %>% map_int(vec_depth)

purrr

Functional Programming Tools

v0.3.4
GPL-3 | file LICENSE
Authors
Lionel Henry [aut, cre], Hadley Wickham [aut], RStudio [cph, fnd]
Initial release

We don't support your browser anymore

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