varlist | R Documentation |
This function prints an inventory of a dataset, similar to Stata's
varlist
function.
varlist(data)
data |
Input data frame (tibble) |
Tibble with the following columns:
name
Variable name
n
Number of non-missing observations
class
Variable class
label
Variable label
# Load mtcars dataset,
# label it, and create missing values
data(mtcars)
df <- mtcars %>%
labelled::set_variable_labels(mpg = "Miles per Gallon",
gear = "Number of Gears") %>%
dplyr::mutate(qsec = dplyr::if_else(am == 1,
true = NA_real_,
false = qsec))
# Show varlist. Note missing values in "qsec".
varlist(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.