set_dic: Set dictionary information to variables

View source: R/dic-constructor.R

set_dicR Documentation

Set dictionary information to variables

Description

Set dictionary information to variables

Usage

set_dic(data, .vars = NULL, ...)

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".

Value

A data frame or a vector with added dic attributes.

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"
)

jazznbass/scaledic documentation built on July 19, 2023, 12:50 a.m.