purrr (version 0.2.5)

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

Run this code
# NOT RUN {
x <- list(
  list(),
  list(list()),
  list(list(list(1)))
)
vec_depth(x)
x %>% map_int(vec_depth)
# }

Run the code above in your browser using DataCamp Workspace