R/empty.R
list_drop_empty.Rd
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).
list_drop_empty()
NULL
integer(0)
vec_slice(x, list_sizes(x) != 0L)
list_drop_empty(x)
A list.
vec_slice()
x <- list(1, NULL, integer(), 2) list_drop_empty(x) #> [[1]] #> [1] 1 #> #> [[2]] #> [1] 2 #>