Display the variable dictionary of a data frame in the RStudio viewer
Source:R/view_dictionary.R
view_dictionary.RdGenerates an interactive variable dictionary based on labelled::look_for().
Accepts data frames, tibbles, and also survey objects.
Usage
view_dictionary(data = NULL, details = c("basic", "none", "full"))
view_detailed_dictionary(data = NULL)
to_DT(
x,
caption = NULL,
column_labels = list(pos = "#", variable = "Variable", col_type = "Type", label =
"Variable label", values = "Values", missing = "Missing values", unique_values =
"Unique values", na_values = "User-defined missings (values)", na_range =
"User-defined missings (range)")
)Arguments
- data
a data frame, a tibble or a survey object (if
NULL, will use the text you currently select in RStudio, useful if the function is called through the corresponding addin)- details
add details about each variable (see
labelled::look_for())- x
a tibble returned by
look_for()- caption
an optional caption for the table
- column_labels
Optional column labels
Note
to_DT() is an utility to convert the result of labelled::look_for() into
a DT::datatable().
Examples
if (FALSE) { # interactive()
iris |> view_dictionary()
}
iris |> labelled::look_for(details = TRUE) |> to_DT()