depth: Depth

View source: R/depth.R

depthR Documentation

Depth

Description

Functions to extract the 'depth' of an object

Usage

depth(x, ...)

## Default S3 method:
depth(x, ...)

## S3 method for class 'list'
depth(x, ...)

Arguments

x

An object

...

Possible additional arguments passed to methods (not in use)

Details

This function does not count an empty lists (list()) as a level or NULL objects.

Value

A single integer

Examples

a <- c(1, 2, 3)
depth(a) # Vectors are 1L

b <- list(a = 1, b = list(list(1)))
depth(b)

jmbarbone/jordan documentation built on April 1, 2024, 7:46 p.m.