This function reads a data dictionary from a file and attaches it to a dataset. The attached data dictionary provides utility functions that can be used by other methods, such as plots, to automatically create axes and more.
read_dictionary(
file,
name = "name",
type = "type",
title = "title",
description = "description",
units = "units",
codes = "codes",
values = "values",
level_separator = "|",
...
)# S3 method for dictionary
print(x, kable = FALSE, include_other = TRUE, ...)
# S3 method for dictionary
[(x, i, ...)
apply_dictionary(data, dict)
has_dictionary(data)
get_dictionary(data)
The dataset with the attached data dictionary.
The path to the file containing the data dictionary.
The name of the column containing the variable name.
The name of the column containing the variable type.
The name of the column containing a short, human-readable title for the variable. If blank, the variable name will be used instead.
The name of the column containing the variable description.
The name of the column containing units (for numeric variables only).
The name of the column containing factor codes (for categorical variables only).
The name of the column containing factor values corresponding to the codes. These should be in the same order as the codes.
The separator used to separate levels in codes
and
values
columns. The default separator is "|".
Alternatively, you can provide a vector of length 2, where the first
element is used for codes
and the second element for values
.
Additional arguments, passed to smart_read
.
A dictionary
object.
If TRUE
, the output will be formatted using kable.
If TRUE
, additional variables will be included in
the output.
Subset index.
A dataset (dataframe, tibble).
A dictionary (created using read_dictionary()
).