vsetequal {vecsets}R Documentation

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)

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.

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.

Author(s)

Carl Witthoft

See Also

setequal, the CRAN package sets

Examples

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

[Package vecsets version 1.4 Index]