is_equal: Checks whether two values are equal including NA

View source: R/recode-with-table.R

is_equalR Documentation

Checks whether two values are equal including NA

Description

Compared to the base "==" operator in R, this function returns true if the two values are NA whereas the base "==" operator returns NA

Usage

is_equal(v1, v2)

Arguments

v1

variable 1

v2

variable 2

Value

boolean value of whether or not v1 and v2 are equal

Examples

is_equal(1,2)
# FALSE

is_equal(1,1)
# TRUE

1==NA
# NA

is_equal(1,NA)
# FALSE

NA==NA
# NA

is_equal(NA,NA)
# TRUE

Big-Life-Lab/recodeflow documentation built on Sept. 12, 2022, 9:13 a.m.