zap_missing: Zap special missings to regular R missings

Description Usage Arguments Examples

View source: R/zap_missing.R

Description

This is useful if you want to convert tagged missing values from SAS or Stata, or user-defined missings from SPSS, to regular R NA.

Usage

1

Arguments

x

A vector or data frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
x1 <- labelled(
  c(1, 5, tagged_na("a", "b")),
  c(Unknown = tagged_na("a"), Refused = tagged_na("b"))
)
x1
zap_missing(x1)

x2 <- labelled_spss(
  c(1, 2, 1, 99),
  c(missing = 99),
  na_value = 99
)
x2
zap_missing(x2)

# You can also apply to data frames
df <- tibble::data_frame(x1, x2, y = 4:1)
df
zap_missing(df)

tidyverse/haven documentation built on Aug. 30, 2018, 5:14 p.m.