powered by
Functions to extract the 'depth' of an object
depth(x, ...)# S3 method for default depth(x, ...)# S3 method for list depth(x, ...)
# S3 method for default depth(x, ...)
# S3 method for list depth(x, ...)
A single integer
integer
An object
Possible additional arguments passed to methods (not in use)
This function does not count an empty lists (list()) as a level or NULL objects.
list()
NULL
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