Read IPUMS geometry using ipumsr::read_ipums_sf
Usage
read_ipums_geometry(
shape_file = NULL,
path = NULL,
file_select = NULL,
vars = "GISJOIN",
encoding = NULL,
bind_multiple = TRUE,
add_layer_var = NULL,
verbose = FALSE
)
Arguments
- shape_file
Path to a single .shp file or a .zip archive containing at least one .shp file. See Details section.
- file_select
If
shape_file
is a .zip archive that contains multiple files, an expression identifying the files to load. Accepts a character string specifying the file name, a tidyselect selection, or index position. If multiple files are selected,bind_multiple
must be equal toTRUE
.- vars
Names of variables to include in the output. Accepts a character vector of names or a tidyselect selection. If
NULL
, includes all variables in the file.- encoding
Encoding to use when reading the shape file. If
NULL
, defaults to"latin1"
unless the file includes a .cpg metadata file with encoding information. The default value should generally be appropriate.- bind_multiple
If
TRUE
andshape_file
contains multiple .shp files, row-bind the files into a singlesf
object. Useful whenshape_file
contains multiple files that represent the same geographic units for different extents (e.g. block-level data for multiple states).- add_layer_var
If
TRUE
, add a variable to the output data indicating the file that each row originates from. Defaults toFALSE
unlessbind_multiple = TRUE
and multiple files exist inshape_file
.The column name will always be prefixed with
"layer"
, but will be adjusted to avoid name conflicts if another column named"layer"
already exists in the data.- verbose
If
TRUE
report additional progress information on load.