1

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?

Dylan Russell
  • 936
  • 1
  • 10
  • 29
  • Fun fact, this has been included in `ggplot2` as `ggplot2:::"%||%"` since at least 2009, with the comment "Analog of || from ruby". – Axeman Jun 28 '22 at 16:33
  • `plot.stepfun` uses it in line 16, obviously since 1997. I wonder, why it evaluates, although `rlang` isn't loaded. – jay.sf Jun 28 '22 at 17:11

1 Answers1

1

Answer credit to @akrun.

%||% is defined in rlang:

`%||%` <- function (x, y) 
{
    if (is_null(x)) 
        y
    else x
}
Dylan Russell
  • 936
  • 1
  • 10
  • 29