View source: R/tab_functions.R
tab_attrs | R Documentation |
Tabulate a dataframe's variables' attributes
tab_attrs(df)
df |
Dataframe |
Dataframe with one row per variable in df
, containing the
following columns: "var", "varlab", "val", "vallab", "format.spss",
"labels", "display_width" & "class". In contrast to tab_types()
the
class shows the original type as it is imported by haven. This means
labelled numerics or characters belong to the class haven_labelled.
path <- system.file("examples", "iris.sav", package = "haven") df <- haven::read_sav(path) %>% # add id column tibble::rownames_to_column("id") df %>% tab_attrs() # Only show variables with a variable label: df %>% tab_attrs() %>% dplyr::filter(!sapply(varlab, is.null))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.