From 0aae59491ec0ef870573f0b76d9729fc55aa09b9 Mon Sep 17 00:00:00 2001 From: gnoblet Date: Wed, 2 Jul 2025 13:45:17 +0200 Subject: [PATCH] Add roxygen2 documentation for custom infix operators --- R/internals.R | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/R/internals.R b/R/internals.R index 4856c41..9adeb32 100644 --- a/R/internals.R +++ b/R/internals.R @@ -1,15 +1,39 @@ # not in +#' Not In Operator +#' +#' A negation of the `%in%` operator that tests if elements of `a` are not in `b`. +#' +#' @param a Vector or value to test +#' @param b Vector to test against +#' +#' @return Logical vector with TRUE for elements of `a` that are not in `b` `%notin%` <- function(a, b) { !(a %in% b) } # not all in +#' Not All In Operator +#' +#' Tests if not all elements of `a` are contained in `b`. +#' +#' @param a Vector to test +#' @param b Vector to test against +#' +#' @return TRUE if at least one element of `a` is not in `b`, otherwise FALSE `%notallin%` <- function(a, b) { !(all(a %in% b)) } # infix for null replacement #' @importFrom rlang `%||%` +#' If Null Replace Operator +#' +#' An alias for the `%||%` operator that returns `a` if it's not NULL, otherwise returns `b`. +#' +#' @param a First value to test +#' @param b Value to use if `a` is NULL +#' +#' @return `a` if not NULL, otherwise `b` `%ifnullrep%` <- function(a, b) { a %||% b }