Learn R Programming

sjmisc (version 1.2)

get_na_flags: Retrieve missing value flags of labelled variables

Description

This function retrieves the logical missing flags for a labelled variable.

Usage

get_na_flags(x)

Arguments

x
Variable (vector) with value label attributes, including missing value codes (see labelled).

Value

  • Logical vector with missing flags that indicate which labelled value is considered as missing.

Details

See 'Details' in get_na.

See Also

get_na to get value codes of labelled missing values; get_values to get values associated with labels; see set_na to replace specific values with NA and to_na to convert missing value codes into NA.

Examples

Run this code
# create labelled integer, with missing flag
x <- labelled(c(1, 2, 1, 3, 4, 1),
              c(Male = 1, Female = 2, Refused = 3, "N/A" = 4),
              c(FALSE, FALSE, TRUE, TRUE))
get_na_flags(x)

Run the code above in your browser using DataLab