R/outersect.R

Defines functions outersect

Documented in outersect

#' Find values not shared between two vectors
#'
#' @param x vector
#' @param y vector
#'
#' @return vector of values not present in both vectors
#' 
#' @examples
#' x <- c(1,2,3,4)
#' y <- c(1,3,5,7)
#' outersect(x, y)
#' 
#' @export
#' 
outersect <- function(x, y) {
  sort(c(setdiff(x, y),
         setdiff(y, x)))
}
johngodlee/JLGMisc documentation built on June 29, 2024, 9:15 p.m.