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

Description Usage Arguments Value Author(s) See Also Examples

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

1
 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

1
2
3
4
5
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

Example output

[1] FALSE
[1] TRUE
[1] TRUE

vecsets documentation built on March 8, 2021, 1:13 a.m.