Skip to content

Commit

Permalink
Reexport %||% from base on newer R versions
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel- committed Jan 9, 2024
1 parent 8797f5b commit 58ed5b1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions R/operators.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
`%||%` <- function(x, y) {
if (is_null(x)) y else x
}

# Reexport from base on newer versions of R to avoid conflict messages
if (exists("%||%", envir = baseenv())) {
`%||%` <- get("%||%", envir = baseenv())
}

`%|0|%` <- function(x, y) {
if (!length(x)) y else x
}
Expand Down

0 comments on commit 58ed5b1

Please sign in to comment.