Learn R Programming

listr (version 0.1.0)

list_extract: 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, ...)

Value

The selected list element.

Arguments

in_list

The list to extract an element from.

...

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

Examples

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

Run the code above in your browser using DataLab