setequal_na {Nmisc}R Documentation

Check if two vectors have the same elements

Description

Wrapper around setequal that adds extra parameter na.rm.

Usage

setequal_na(x, y, na.rm = FALSE)

Arguments

x, y

Vectors (of the same mode) containing a sequence of items.

na.rm

Boolean value indicating whether NA should be omitted or not.

Value

A logical scalar that states the result.

Examples

setequal_na(c(2, 1, 3), c(1, 2, 3))
# returns TRUE

setequal_na(c(1, NA, 3), c(3, NA, 1), na.rm = TRUE)
# returns TRUE

setequal_na(c(NA, NA), c(NA), na.rm = TRUE)
# returns TRUE

setequal_na(c(NA, NA), c(NA))
# returns TRUE

setequal_na(c(1, 2, 3), c(1, 2, 3, NA))
# returns FALSE


[Package Nmisc version 0.3.7 Index]