setequal_na: Check if two vectors have the same elements

Description Usage Arguments Value Examples

View source: R/set-misc.R

Description

Wrapper around setequal that adds extra parameter na.rm.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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

Nmisc documentation built on April 28, 2021, 5:10 p.m.