Learn R Programming

SeuratObject (version 5.0.2)

set-if-null: Set If or If Not NULL

Description

Set a default value depending on if an object is NULL

Usage

x %||% y

x %iff% y

Value

For %||%: y if x is NULL; otherwise x

For %iff%: y if x is not

NULL; otherwise x

Arguments

x

An object to test

y

A default value

Author

For %||%: rlang developers

See Also

Examples

Run this code
# Set if NULL
1 %||% 2
NULL %||% 2

# Set if *not* NULL
1 %iff% 2
NULL %iff% 2

Run the code above in your browser using DataLab