I am going through some of the ggplot2
code and I stumbled over (well actually the compiler stumbled over it) the %||%
operator. I imagine it is some kind of an "logical-or" function, seemingly related to parameters, but somehow it is not defined in my environment. I have included all the dependencies that I think ggplot2
has (plyr,scales,reshape2,digest,MASS,gtable
) with a library
statement but it did not help.
?%||%
and ??%||%
from R-studio didn't help, neither did using the SO search and Google and even Bing. I actually think most search services just refuse to search for such things, which makes finding these operators really difficult.
Not really sure where to look now, short of bugging the package authors who have far better things to do with their time - especially these package authors.
So where is it, and where should/could I have looked to find it? I really want to be self-sufficient about these kind of things.
Your initial approach was good, one additional trick would be to add backticks to your query:
R> ?`%||%`
Which brings up the help page for null-default from purrr that describes it as "This infix function makes it easy to replace NULLs with a default value"
In use:
R> 1 %||% 2
[1] 1
R> NULL %||% 2
[1] 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With