nil {infix}R Documentation

Default value for NULL

Description

This infix function makes it easy to replace NULL's with a default value. It's inspired by the way that Ruby's or operation (`||`) works.

Usage

a %||% b

Arguments

a, b

If a is NULL, will return b; otherwise returns a.

Examples

1 %||% 2 # returns 1
NULL %||% 2 # returns 2

[Package infix version 0.1.0 Index]