codebook {volker} | R Documentation |
Get variable and value labels from a data set
Description
Variable labels are extracted from their comment or label attribute. Variable values are extracted from factor levels, the labels attribute, numeric or boolean attributes.
Usage
codebook(data, cols, values = TRUE)
Arguments
data |
A tibble. |
cols |
A tidy variable selections to filter specific columns. |
values |
Whether to output values (TRUE) or only items (FALSE) |
Details
Value
A tibble with the columns:
item_name: The column name.
item_group: First part of the column name, up to an underscore.
item_class: The last class value of an item (e.g. numeric, factor).
item_label: The comment attribute of the column.
value_name: In case a column has numeric attributes, the attribute names.
value_label: In case a column has numeric attributes or T/F-attributes, the attribute values. In case a column has a levels attribute, the levels.
Examples
volker::codebook(volker::chatgpt)