Learn R Programming

ipumsr (version 0.6.3)

read_nhgis_sf: Read and combine tabular and spatial data from an NHGIS extract

Description

[Deprecated]

The simultaneous loading of tabular and spatial data has been deprecated. Splitting this functionality allows for more control over the data reading and joining process.

Please read spatial and tabular data separately using read_ipums_sf() and read_nhgis(). To join spatial and tabular data, use an ipums_shape_*_join function.

To convert an sf object to a SpatialPolygonsDataFrame or other sp object, use sf::as_Spatial().

Usage

read_nhgis_sf(
  data_file,
  shape_file,
  data_layer = NULL,
  shape_layer = data_layer,
  shape_encoding = "latin1",
  verbose = TRUE,
  var_attrs = c("val_labels", "var_label", "var_desc")
)

read_nhgis_sp( data_file, shape_file, data_layer = NULL, shape_layer = data_layer, shape_encoding = "latin1", verbose = TRUE, var_attrs = c("val_labels", "var_label", "var_desc") )

Arguments

data_file

Path to a data file, a .zip archive from an NHGIS extract, or a directory containing the data file.

shape_file

Path to a .shp file, a .zip archive from an NHGIS extract, or a directory containing the .shp file.

data_layer

If data_file is a .zip archive or directory 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.

shape_layer

If shape_file is a .zip archive or directory 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.

shape_encoding

The text encoding to use when reading the shape file. Defaults to "latin1", which should be appropriate for most files.

verbose

Logical indicating whether to print progress information to the console.

var_attrs

Variable attributes to add from the codebook. Defaults to all available attributes ("val_labels", "var_label" and "var_desc"). See set_ipums_var_attributes() for more details.