From 58ed5b185c94e4fbbbfa0b4e7e7993564994785c Mon Sep 17 00:00:00 2001 From: Lionel Henry Date: Tue, 9 Jan 2024 10:42:03 +0100 Subject: [PATCH] Reexport `%||%` from base on newer R versions --- R/operators.R | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/R/operators.R b/R/operators.R index dfacbf60a1..3210b63472 100644 --- a/R/operators.R +++ b/R/operators.R @@ -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 }