labels: Get / Declare missing values

Description Usage Arguments Value Examples

Description

Functions to extract information about the declared missing values, or to declare such values if they are present in the data.

Usage

1
2
3
4
5
6
7
value_labels(x, prefixed = FALSE)

value_labels(x) <- value

variable_label(x)

variable_label(x) <- value

Arguments

x

A vector.

prefixed

Logical, prefix labels with values.

value

Any vector of values that should be declared as missing (for value_labels) or a numeric vector of length two giving the (inclusive) extents of the range of missing values (for variable_label).

Value

value_labels() will return a named vector.

variable_label() will return a single character string.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
x <- mixed_labelled(c(-2, 1:5, -1),
                    labels = c(Good = 1, Bad = 5, DK = -1),
                    na_values = c(-1, -2),
                    label = "Test variable")
x

value_labels(x)

value_labels(x) <- c(Good = 1, Bad = 5, DK = -1, NotApplicable = -2)

variable_label(x)

variable_label(x) <- "This is a proper label"

dusadrian/mixed documentation built on Dec. 20, 2021, 2:16 a.m.