null_coalesce: Null coalescing operator

null_coalesceR Documentation

Null coalescing operator

Description

Returns the first argument if it is not NULL or empty, otherwise returns the second argument.

Usage

x %||% y

Arguments

x

An object to test if NULL or empty

y

An object to return if x is NULL or empty

Value

Returns x if x is not NULL, not empty, or not a missing XML node, otherwise returns y.

Examples

NULL %||% "default"  # returns "default"
"value" %||% "default"  # returns "value"

LBDiscover documentation built on June 16, 2025, 5:09 p.m.