drop_undeclare | R Documentation |
A function to obtain a version of the object with all information about declared missing values, dropped
undeclare(x, drop = FALSE, ...)
drop_na(x, drop_labels = TRUE)
x |
A labelled object with declared missing values |
drop |
Logical, drop all attributes |
... |
Other internal arguments |
drop_labels |
Logical, drop the labels for the declared missing values |
The function undeclare()
replaces the NA entries into their original
numeric values, and drops all attributes related to missing values:
na_values
, na_range
and na_index
, and it preserves the labels referring
to the missing values.
The result can be a regular vector (dropping all attributes, including the
class "declared") by activating the argument drop
.
Function drop_na()
transforms the declared missing values in regular empty
NAs, and the labels referring to the missing values are deleted by default.
Function drop()
deletes all attributes.
A declared labelled object.
Other labelling functions:
labels()
,
measurement()
x <- declared(
c(-2, 1:5, -1),
labels = c("Good" = 1, "Bad" = 5, "DK" = -1),
na_values = c(-1, -2),
label = "Test variable"
)
x
undeclare(x)
drop_na(x)
drop(x)
undeclare(x, drop = TRUE)
# similar to:
drop(undeclare(x))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.