Different versions of "%||%" operator: where is this documented?

I came across this operator when trying to figure out why reprex shoots a message that it can’t copy to clipboard. (that message is simply hardcoded in reprex::reprex). I’ve noticed an operator %||% that I could find back in both devtools and reprex, but with a slightly different function definition. Both work the same way though, it’s just written differently. The idea is:

function(a,b) if(is.null(a)) b else a

It seems to be used in more packages related to tidyverse, but I couldn’t find it anywhere in any documentation. ?%||% turns up nothing either.

Hence the question: is this supposed to be part of the tidy suite, and if so, is this documented somewhere?



1 Like

Thanks. Funny, because I have purrr installed but getAnywhere() didn’t even mention it the first time. Found it now, thx.