Learn R Programming

vecsets (version 1.4)

vsetequal: Check whether two vectors contain exactly the same collection of elements.

Description

Unlike the base::setequal function, if the vectors have repeated elements in common, the count of these elements is checked. As a result, vectors of different lengths will never be "equal."

Usage

vsetequal(x, y, multiple = TRUE)

Value

A logical value indicating equality or inequality. If multiple=FALSE is set, both input vectors are reduced to unique values before checking for equality.

Arguments

k

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 TRUE; if set to FALSE, vsetequal acts like the base::intersect function.

Author

Carl Witthoft

See Also

setequal, the CRAN package sets

Examples

Run this code
x <- c(1:5,3,3,3,2,NA,NA)
y<- c(1:5,4,3,NA)
vsetequal(x,y)
vsetequal(x,y,multiple=FALSE) 
setequal(x,y) #same as previous line

Run the code above in your browser using DataLab