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

Examples

null_if_empty(c())
#> NULL

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