I am working with some Code containing the expression %||%.
This is the context i encountered it:
# Example list for minimal example
df <- list(a=1,2,c=3)
# code
ind <- names(df) %||% seq_along(df)
But R cannot find the operator %||%. I guess a package is not installed but i do not know which one. I also cannot find it on google or stackoverflow.
Could someone explain what it does and which package it belongs to?
It's from ggplot2 utilities.
"%||%" <- function(a, b) {
if (!is.null(a)) a else b
}
You can find in utilities.r
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