Skip to contents

Return NULL if the input is empty, otherwise return the input

Usage

null_if_empty(x)

Arguments

x

vector

Value

vector or NULL

See also

Other vctrs: empty(), gchop(), search_in(), search_in_impl()

Examples

null_if_empty(c())
#> NULL

null_if_empty(c(1))
#> [1] 1