Loosely replicates the behavior of the homonym Matlab function
Usage
setdiff(A, B, legacy = FALSE)
Arguments
- A
first array
- B
second array
- legacy
if TRUE
, preserves the behavior of the setdiff function from
MATLAB R2012b and prior releases. (currently not supported)
Value
An array containing he elements which are in A but not in B
Examples
A <- c(3, 6, 2, 1, 5, 1, 1)
B <- c(2, 4, 6)
setdiff(A, B)
#> [1] 1 3 5