Skip to contents

Read NHGIS data using ipumsr::read_nhgis

Usage

read_nhgis_data(
  data_file = NULL,
  path = NULL,
  file_select = NULL,
  multiple = TRUE,
  verbose = FALSE,
  ...,
  format = c("tidy", "wide"),
  variable_col = "variable",
  value_col = "value",
  column_title_col = "column_title",
  denominator_prefix = "denominator_",
  perc_prefix = "perc_",
  digits = 2
)

read_nhgis_ext(
  data_file,
  file_select = NULL,
  verbose = FALSE,
  var_attrs = c("val_labels", "var_label", "var_desc"),
  show_col_types = FALSE,
  ...,
  format = "tidy",
  variable_col = "variable",
  value_col = "value",
  column_title_col = "column_title",
  denominator_prefix = "denominator_",
  perc_prefix = "perc_",
  digits = 2
)

Arguments

data_file

Path to a .zip archive containing an NHGIS extract or a single file from an NHGIS extract.

file_select

If data_file is a .zip archive that contains multiple files, an expression identifying the file to load. Accepts a character vector specifying the file name, a tidyselect selection, or an index position. This must uniquely identify a file.

verbose

Logical controlling whether to display output when loading data. If TRUE, displays IPUMS conditions, a progress bar, and column types. Otherwise, all are suppressed.

Will be overridden by readr.show_progress and readr.show_col_types options, if they are set.

var_attrs

Variable attributes to add from the codebook (.txt) file included in the extract. Defaults to all available attributes.

See set_ipums_var_attributes() for more details.