op-null-default

0th

Percentile

Default value for NULL

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.

Aliases
  • op-null-default
  • %||%
Examples
library(rlang) # NOT RUN { 1 %||% 2 NULL %||% 2 # }
Documentation reproduced from package rlang, version 0.2.0, License: GPL-3

Community examples

Looks like there are no examples yet.