Reputation: 1547
I am trying to run some R code from github, however these functions use a command %||%
, that doesn't seem to be in base R. What exactly does this function do and what packages, if any, do I need to get it to work on my machine? As you can imagine, this particular string is un-Google-able since it's entirely special characters.
Upvotes: 5
Views: 2935
Reputation: 226087
From https://github.com/hadley/devtools/blob/master/R/utils.r
"%||%" <- function(a, b) if (!is.null(a)) a else b
It's an internal function, so you probably need to redefine it for yourself if you want to use it outside the package.
"%||%" <- devtools:::`%||%`
1 %||% NULL
## [1] 1
NULL %||% 2
## [1] 2
Upvotes: 10