Learn R Programming

mark (version 0.8.2)

depth: Depth

Description

Functions to extract the 'depth' of an object

Usage

depth(x, ...)

# S3 method for default depth(x, ...)

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

Value

A single integer

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.

Examples

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

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

Run the code above in your browser using DataLab