harmonize_value_labels: Harmonize Value Labels

Description Usage Arguments Value See Also Examples

Description

Harmonize the numeric values and the value labels of variables. Currently works only with binary values.

Usage

1
harmonize_value_labels(labelled_var, categories = 2)

Arguments

labelled_var

A vector (survey variable) coded in with labelled class.

categories

The number of valid categories in the value range.

Value

A labelled vector containing harmonized numeric values and labels, and in attr(v, num_orig) the original numeric values, attr(v, labels_orig) the original labelling.

See Also

Other harmonization functions: eurobarometer_special_values()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
v <- labelled::labelled(
       c(3,4,4,3,8, 9),
       c(YES = 3, NO = 4, wrong_label = 8, refused = 9)
      )
harmonize_value_labels(v, 2)

v3 <- labelled::labelled(c(3,4,5,3,8, 9),
c(`BETTER`= 3, `WORSE`= 4,
  `SAME` = 5,
  wrong_label = 8, refused = 9))

harmonize_value_labels(
  labelled_var = v3,categories = 3)

antaldaniel/eurobarometer documentation built on Aug. 31, 2020, 10:57 p.m.