Dylan Russell
Dylan Russell

Reputation: 1098

R - %||% pipe operator

I'm trying to reuse snippets of code from the r-lib repository. I can't find where this particular pipe operator is defined:

getOption("usethis.description") %||% list()

Could anyone direct me to the source code for this pipe operator?

Upvotes: 1

Views: 63

Answers (1)

Dylan Russell
Dylan Russell

Reputation: 1098

Answer credit to @akrun.

%||% is defined in rlang:

`%||%` <- function (x, y) 
{
    if (is_null(x)) 
        y
    else x
}

Upvotes: 1

Related Questions