Learn R Programming

TrustVDJ (version 0.1.0)

Ifnone: Default for NULL and NA value

Description

set default value for object, including NULL and NA and length 0.

Usage

x %|||% y

Arguments

x

character/numeric/factor/list. An object which could be checked by is.na().

y

ANY. A default value

Value

%|||%: x unless NULL, NA nor length(x) == 0, otherwise y

Examples

Run this code
# NOT RUN {
1    %|||% 1
NA   %|||% 1
NULL %|||% 1

# }

Run the code above in your browser using DataLab