| zap_na_tags | R Documentation |
Replaces all tagged_na() values with
regular NA.
zap_na_tags(x, ...)
x |
A |
... |
Optional, unquoted names of variables that should be selected for
further processing. Required, if |
x, where all tagged_na values are converted to NA.
if (require("haven")) {
x <- labelled(
c(1:3, tagged_na("a", "c", "z"), 4:1),
c("Agreement" = 1, "Disagreement" = 4, "First" = tagged_na("c"),
"Refused" = tagged_na("a"), "Not home" = tagged_na("z"))
)
# get current NA values
x
get_na(x)
zap_na_tags(x)
get_na(zap_na_tags(x))
# also works with non-labelled vector that have tagged NA values
x <- c(1:5, tagged_na("a"), tagged_na("z"), NA)
haven::print_tagged_na(x)
haven::print_tagged_na(zap_na_tags(x))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.