Learn R Programming

formatters (version 0.5.10)

ifnotlen0: %||% (if length-0) alternative operator

Description

%||% (if length-0) alternative operator

Usage

a %||% b

Value

a if it is not of length 0, otherwise b.

Arguments

a

(ANY)
element to select only if it is not of length 0.

b

(ANY)
element to select if a has length 0.

Examples

Run this code
6 %||% 10

character() %||% "hi"

NULL %||% "hi"

Run the code above in your browser using DataLab