Improvements to setdiff
This commit is contained in:
parent
eba8705d9e
commit
6b1a1910e3
3 changed files with 26 additions and 4 deletions
10
R/setdiff.R
10
R/setdiff.R
|
|
@ -6,8 +6,12 @@
|
|||
#' @return
|
||||
#' @author Waldir Leoncio
|
||||
#' @export
|
||||
setdiff <- function(A, B, legacy = FALSE) {
|
||||
values <- sort(unique(A[is.na(match(A, B))]))
|
||||
# browser() # TEMP
|
||||
setdiff_MATLAB <- function(A, B, legacy = FALSE) {
|
||||
if (is(A, "numeric") & is(B, "numeric")) {
|
||||
values <- sort(unique(A[is.na(match(A, B))]))
|
||||
} else if (is(A, "data.frame") & is(B, "data.frame")) {
|
||||
stop("Not implemented for data frames")
|
||||
}
|
||||
# TODO: add support for indices (if necessary)
|
||||
return(values)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue