| ipums_var_info | R Documentation |
Summarize the variable metadata for the variables found in an ipums_ddi
object or data frame. Provides descriptions of variable
content (var_label and var_desc) as well as labels of particular
values for each variable (val_labels).
ipums_var_info() produces a tibble summary
of multiple variables at once.
ipums_var_label(), ipums_var_desc(), and ipums_val_labels() provide
specific metadata for a single variable.
ipums_var_info(object, vars = NULL)
ipums_var_label(object, var = NULL)
ipums_var_desc(object, var = NULL)
ipums_val_labels(object, var = NULL)
object |
An ipums_ddi object, a data frame containing variable
metadata (as produced by most ipumsr data-reading functions), or
a |
vars, var |
A tidyselect selection identifying
the variable(s) to include in the output. Only |
For ipums_var_info(), if the provided object is a
haven::labelled()
vector (i.e. a single column from a data frame), the summary output will
include the variable label, variable description, and value labels, if
applicable.
If it is a data frame, the same information will be
provided for all variables present in the data or to those indicated in
vars.
If it is an ipums_ddi object, the summary will also include information used when reading the data from disk, including start/end positions for columns in the fixed-width file, implied decimals, and variable types.
Providing an ipums_ddi object is the most robust way to access
variable metadata, as many data processing operations will remove these
attributes from data frame-like objects.
For ipums_var_info(), a tibble containing
variable information.
Otherwise, a length-1 character vector with the requested variable information.
read_ipums_ddi() or read_nhgis_codebook() to read IPUMS metadata files.
ddi <- read_ipums_ddi(ipums_example("cps_00157.xml"))
# Info for all variables in a data source
ipums_var_info(ddi)
# Metadata for individual variables
ipums_var_desc(ddi, MONTH)
ipums_var_label(ddi, MONTH)
ipums_val_labels(ddi, MONTH)
# NHGIS also supports variable-level metadata, though many fields
# are not relevant and remain blank:
cb <- read_nhgis_codebook(ipums_example("nhgis0972_csv.zip"))
ipums_var_info(cb)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.