unnest.list: Collapse Uninformative Levels of a List

View source: R/yamlet.R

unnest.listR Documentation

Collapse Uninformative Levels of a List

Description

The list method for unnest() recursively ascends a nested list, removing uninformative levels.

Usage

## S3 method for class 'list'
unnest(x, ...)

Arguments

x

list

Value

list

See Also

Other unnest: unnest.default(), unnest()

Examples


a <- 'ITEM: [ label: sunshine, [foo: 1, bar: 3]]'

#  yaml.load() sees label nested one-deep, and foo nested two-deep:
yaml::yaml.load(a)

# unnest() sees label nested zero-deep, and foo nested one-deep:
unnest(yaml::yaml.load(a))

# as_yamlet() provides explicit name (default key) for second element of ITEM:
as_yamlet(a)

yamlet documentation built on Oct. 6, 2023, 9:07 a.m.