is.empty | R Documentation |
Functions that indicate which elements are empty NA
missing values, in
contrast to declared missing values.
is.empty(x)
anyNAempty(x)
x |
A vector |
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.
A logical vector.
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.