Shows a breakdown of the different types of missing values in a variable
that was read with read_spss(), read_stata(), read_sas(), or
read_xpt() and contains tagged NAs.
Value
A data frame with columns:
- tag
The tag character (e.g., a-z for Stata, A-Z for SAS, a-z/A-Z/0-9 for SPSS)
- n
Number of cases with this missing type
- code
The original missing value code: numeric SPSS codes (e.g., -9, -8) or native format codes (e.g., ".a" for Stata, ".A" for SAS)
- label
The value label for this missing type (if available)
See also
read_spss(), read_stata(), read_sas(), read_xpt(),
untag_na(), strip_tags()
Other data-import:
read_por(),
read_sas(),
read_spss(),
read_stata(),
read_xlsx(),
read_xpt(),
strip_tags(),
untag_na()
Examples
# \donttest{
if (requireNamespace("haven", quietly = TRUE)) {
# Declare -9/-8 as distinct tagged missing types, then inspect them
x <- set_na(c(1, 2, -9, 3, -8, -9), -9, -8)
na_frequencies(x)
# tag n code label
# 1 a 2 -9 <NA>
# 2 b 1 -8 <NA>
}
#> tag n code label
#> 1 a 2 -9 <NA>
#> 2 b 1 -8 <NA>
#> 3 <NA> 0 <NA> (System Missing)
# }
