num_total_elements {xpectr} | R Documentation |
Total number of elements
Description
Unlists `x`
recursively and finds the total number of elements.
Usage
num_total_elements(x, deduplicated = FALSE)
Arguments
x |
List with elements. |
deduplicated |
Whether to only count the unique elements. (Logical) |
Details
Simple wrapper for
length(unlist(x, recursive = TRUE, use.names = FALSE))
.
Value
The total number of elements in `x`
.
Author(s)
Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk
See Also
Other element descriptors:
element_classes()
,
element_lengths()
,
element_types()
Examples
# Attach packages
library(xpectr)
l <- list(list(list(1, 2, 3), list(2, list(3, 2))),
list(1, list(list(2, 4), list(7, 1, list(3, 8)))),
list(list(2, 7, 8), list(10, 2, list(18, 1, 4))))
num_total_elements(l)
num_total_elements(l, deduplicated = TRUE)
[Package xpectr version 0.4.3 Index]