R/between_operators.R

Defines functions `%btwn%` `%_btwn_%`

#' @title Between operators
#'
#' @description Between operators covering both inclusive and exclusive checks
#'
#' @examples
#' a <- c(0:10)
#' a %btwn% c(1,5) # inclusive between (1 and 5 included)
#' a %_btwn_% c(1,5) # exclusive between (1 and 5 not included)
#' @export
`%btwn%` <- function(x, y)
{
  x >= min(y) & x <= max(y)
}

#' @export
`%_btwn_%` <- function(x, y)
{
  x > min(y) & x < max(y)
}
Prometheus77/actools documentation built on March 7, 2020, 11:01 a.m.