element_types {xpectr}R Documentation

Gets the type of each element

Description

[Experimental]

Applies typeof() to each element of `x` (without recursion).

Usage

element_types(x, keep_names = FALSE)

Arguments

x

List with elements.

keep_names

Whether to keep existing names. (Logical)

Details

Simple wrapper for unlist(lapply(x, typeof)).

Value

The type of each element.

Author(s)

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

See Also

Other element descriptors: element_classes(), element_lengths(), num_total_elements()

Examples

# Attach packages
library(xpectr)

l <- list("a" = c(1,2,3), "b" = "a", "c" = NULL)

element_types(l)
element_types(l, keep_names = TRUE)

[Package xpectr version 0.4.3 Index]