promote_elements: Convert a list to a wide tibble.

View source: R/promote_elements.R

promote_elementsR Documentation

Convert a list to a wide tibble.

Description

promote_elements converts multi-value elements of a list into uniquely named elements of the [primary] list. [What's a better way to say this?]

Usage

promote_elements(x, combine_names = TRUE, recursive = FALSE)

Arguments

x

A list.

Value

If any of the elements of the list had multiple value, these values will now be included as separate elements in the top level.

Examples


mylist <- list("A" = 1, "B" = c(1,2,4),
               "C" = letters[1:5],
               "D" = list(10:20, fruit = c("orange", "apple", "banana")))
mylist
promote_elements(mylist)

# The following two lines are equivalent for this example:
promote_elements(promote_elements(mylist))
promote_elements(mylist, recursive = TRUE)

barefootbiology/heyexr documentation built on July 9, 2022, 3:35 a.m.