Learn R Programming

formatters (version 0.5.0)

ifnotlen0: %||% If length-0 alternative operator

Description

%||% If length-0 alternative operator

Usage

a %||% b

Value

a, unless it is length 0, in which case b (even in the case b is also length 0)

Arguments

a

ANY. Element to select only if it is not length 0

b

ANY. Element to select if a is length 0

Examples

Run this code
6 %||% 10

character() %||% "hi"

NULL %||% "hi"

Run the code above in your browser using DataLab