cmbarbu
cmbarbu

Reputation: 4534

Meaning of %||% in R

Found in roxygen2 code the shortcut :

%||%

No help can be found with

?"%||%"

It looks like a shortcut for union() but how could I display it's definition ?

Upvotes: 2

Views: 72

Answers (1)

rbm
rbm

Reputation: 3253

From source (utils.R from roxygen2_4.1.1.tar.gz)

"%||%" <- function(a, b) {
  if (!is.null(a)) a else b
}

Upvotes: 4

Related Questions