is.empty: Test the presence of empty (undeclared) missing values

is.emptyR Documentation

Test the presence of empty (undeclared) missing values

Description

Functions that indicate which elements are empty NA missing values, in contrast to declared missing values.

Usage

is.empty(x)

anyNAempty(x)

Arguments

x

A vector

Details

All missing values, declared or undeclared, as stored as regular NA values, therefore the base function is_na() does not differentiate between them.

These functions are specifically adapted to objects of class "declared", to return a truth value only for those elements that are completely missing with no reason.

Value

A logical vector.

Examples


x <- declared(
    c(1:2, -91),
    labels = c(Good = 1, Bad = 2, Missing = -91),
    na_values = -91
)

x

is.empty(x) # FALSE FALSE FALSE

anyNAempty(x) # FALSE

x <- c(x, NA)

is.empty(x) # FALSE FALSE FALSE  TRUE

anyNAempty(x) # TRUE


declared documentation built on May 29, 2024, 12:09 p.m.

Related to is.empty in declared...