list_extract: Extract an element from a list using tidy selection.

View source: R/list_extract.R

list_extractR Documentation

Extract an element from a list using tidy selection.

Description

This is pretty much an equivalent of calling '[[' on a list, but allows for cleaner use inside pipes.

Usage

list_extract(in_list, ...)

Arguments

in_list

The list to extract an element from.

...

A selection of what to extract. Must be a single element.

Value

The selected list element.

Examples

my_list <- list(rnorm(20), data.frame(x = 1:10, y = rnorm(10)), letters[1:5])
list_extract(my_list, 3)

listr documentation built on Oct. 6, 2022, 5:11 p.m.