R: Compute the depth of a vector

vec_depth {purrr} | R Documentation

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

[Package purrr version 0.2.4 Index]