grapes-or-or-grapes: NULL Replacement

grapes-or-or-grapesR Documentation

NULL Replacement

Description

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

Usage

x %||% y

Arguments

x, y

If x is NULL, will return y; otherwise returns x.

Examples

1 %||% 2
NULL %||% 2

jagg19/AlpacaforR documentation built on July 3, 2023, 12:14 p.m.