ipums_ddi-class: 'ipums_ddi' class

ipums_ddi-classR Documentation

ipums_ddi class

Description

The ipums_ddi class provides a data structure for storing the metadata information contained in IPUMS codebook files. These objects are primarily used when loading IPUMS data, but can also be used to explore metadata for an IPUMS extract.

  • For microdata projects, this information is provided in DDI codebook (.xml) files.

  • For NHGIS, this information is provided in .txt codebook files.

The codebook file contains metadata about the extract files themselves, including file name, file path, and extract date as well as information about variables present in the data, including variable names, descriptions, data types, implied decimals, and positions in the fixed-width files.

This information is used to correctly parse IPUMS fixed-width files and attach additional variable metadata to data upon load.

Note that codebook metadata for NHGIS extracts can also be stored in an ipums_ddi object, even though these codebooks are distributed as .txt files, not .xml files. These files do not adhere to the same standards as the DDI codebook files, so some ipums_ddi fields will be left blank when reading NHGIS codebooks.

Creating an ipums_ddi object

  • To create an ipums_ddi object from an IPUMS microdata extract, use read_ipums_ddi().

  • To create an ipums_ddi object from an IPUMS NHGIS extract, use read_nhgis_codebook()

Loading data

  • To load the data associated with an ipums_ddi object, use read_ipums_micro(), read_ipums_micro_chunked(), or read_ipums_micro_yield()

View metadata

  • Use ipums_var_info() to explore variable-level metadata for the variables included in a dataset.

  • Use ipums_file_info() to explore file-level metadata for an extract.


ipumsr documentation built on Sept. 12, 2024, 7:38 a.m.