vsetdiff | R Documentation |
Finds all elements in first argument which are not in the second argument. Unlike the base::setdiff
function, if the vectors have repeated elements in common, only the "excess" number of a given element are returned.
vsetdiff(x, y, multiple = TRUE)
x |
A vector or an object which can be coerced to a vector |
y |
A vector or an object which can be coerced to a vector |
multiple |
Should repeated "multiple" items be returned? Default is |
A vector of all elements in x
which are not in y
. If multiple=FALSE
is set, only unique values are returned.
Carl Witthoft
setdiff
, the CRAN package sets
x <- c(1:5,3,3,3,2,NA,NA)
y<- c(2:5,4,3,NA)
vsetdiff(x,y)
vsetdiff(x,y,multiple=FALSE)
setdiff(x,y) # same as previous line
vsetdiff(y,x) #note the asymmetry
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.