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()
.
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")
)
Path to a data file, a .zip archive from an NHGIS extract, or a directory containing the data file.
Path to a .shp file, a .zip archive from an NHGIS extract, or a directory containing the .shp file.
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.
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.
The text encoding to use when reading the shape file.
Defaults to "latin1"
, which should be appropriate for most files.
Logical indicating whether to print progress information to the console.
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.