Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

coalesce

Coalesce operator


Description

Returns the left hand side if not missing nor NULL, and the right hand side otherwise.

Usage

lhs %??% rhs

Arguments

lhs

[any]
Left hand side of the operator. Is returned if not missing or NULL.

rhs

[any]
Right hand side of the operator. Is returned if lhs is missing or NULL.

Value

Either lhs or rhs.

Examples

print(NULL %??% 1 %??% 2)
print(names(iris) %??% letters[seq_len(ncol(iris))])

checkmate

Fast and Versatile Argument Checks

v2.0.0
BSD_3_clause + file LICENSE
Authors
Michel Lang [cre, aut] (<https://orcid.org/0000-0001-9754-0393>), Bernd Bischl [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.