Skip to contents

Converts all tagged NAs to regular (untagged) NA values, effectively removing the missing value type information. Works with data from any format: read_spss(), read_por(), read_stata(), read_sas(), or read_xpt().

Usage

strip_tags(x)

Arguments

x

A numeric vector with tagged NAs.

Value

A numeric vector where all tagged NAs have been replaced with regular NA. Value labels for missing types are removed; labels for valid values are preserved.

Examples

# \donttest{
if (requireNamespace("haven", quietly = TRUE)) {
  x <- set_na(c(1, 2, -9, 3, -8), -9, -8)
  # Remove tag information: all missings become plain NA
  strip_tags(x)
}
#> [1]  1  2 NA  3 NA
# }