Implemented basic functionality of setdiff

This commit is contained in:
Waldir Leoncio 2020-10-19 15:32:34 +02:00
parent f28bf5d763
commit eba8705d9e
2 changed files with 24 additions and 4 deletions

13
R/setdiff.R Normal file
View file

@ -0,0 +1,13 @@
#' @title Set differences of two arrays
#' @description Loosely replicates the behavior of the homonym Matlab function
#' @param A first array
#' @param B second awway
#' @param legacy if `TRUE`, preserves the behavior of
#' @return
#' @author Waldir Leoncio
#' @export
setdiff <- function(A, B, legacy = FALSE) {
values <- sort(unique(A[is.na(match(A, B))]))
# browser() # TEMP
return(values)
}