collect: Collect Elements of Sublists

View source: R/collect.R

collectR Documentation

Collect Elements of Sublists

Description

Collect Elements of Sublists

Usage

collect(x, element, default = NULL)

Arguments

x

a list of lists

element

name of list element to be collected from each sublist of x

default

value to be returned for lists that do not have an element called element.

Examples

x <- list(
  list(a = 1, b = 2),
  list(c = 3, a = 4),
  list(d = 5, e = 6)
)

collect(x, "a")
collect(x, "a", default = 99)


KWB-R/kwb.prep documentation built on June 11, 2022, 1:29 p.m.