Set dictionary information to variables
set_dic.Rd
Set dictionary information to variables
Arguments
- data
A data frame or a vector.
- .vars
Character vector with variable names. If data is a data frame, address these variables. If left
NULL
and data is a data frame, all variables from the data frame are addressed.- ...
dic attributes of the form
attribute = value
.
Details
Standard attributes are: "item_name"
, "item_label"
, "weight"
,
"type"
, "values"
, "value_labels"
, "missing"
.
Examples
hap_1 <- sample(1:5, 30, replace = TRUE)
set_dic(hap_1,
item_label = "How do you feel today?",
scale = "hap",
scale_label = "Happiness",
values = 1:3,
value_labels = "1 = not happy; 2 = in between; 3 = happy"
)
#> 1: Attribute 'item_name' missing and set to 'hap_1'.
#> 2: Attribute 'type' missing and set to 'integer'.
#> 3: Attribute 'weight' missing and set to 1.
#> # How do you feel today? (Happiness)
#> # Data type is integer
#> # Valid values: 1:3
#> # Value labels:
#> # 1 = not happy
#> # 2 = in between
#> # 3 = happy
#> [1] 3 3 3 2 2 4 4 2 5 4 1 2 1 1 5 4 5 1 5 5 4 3 3 5 3 2 1 4 5 5