Skip to contents

See declared::declared for details.

Arguments

x

A numeric vector to label, or a declared labelled vector (for undeclare)

labels

A named vector or NULL. The vector should be the same type as x. Unlike factors, labels don't need to be exhaustive: only a fraction of the values might be labelled

na_values

A vector of values that should also be considered as missing

na_range

A numeric vector of length two giving the (inclusive) extents of the range. Use -Inf and Inf if you want the range to be open ended

label

A short, human-readable description of the vector

measurement

Optional, user specified measurement level

llevels

Logical, when x is a factor only use those levels that have labels

...

Other arguments used by various other methods

Value

The result of calling rhs(lhs).

Examples

x <- declared(
  c(1:5, -1),
  labels = c(Good = 1, Bad = 5, DK = -1),
  na_values = -1
)