list_drop_empty: Drop empty elements from a list

View source: R/empty.R

list_drop_emptyR Documentation

Drop empty elements from a list

Description

list_drop_empty() removes empty elements from a list. This includes NULL elements along with empty vectors, like integer(0). This is equivalent to, but faster than, vec_slice(x, list_sizes(x) != 0L).

Usage

list_drop_empty(x)

Arguments

x

A list.

Dependencies

  • vec_slice()

Examples

x <- list(1, NULL, integer(), 2)
list_drop_empty(x)

vctrs documentation built on May 29, 2024, 11:39 a.m.