This function adds location data to the rows of a SAFE data worksheet,
converting it into a sf
spatial features object. Rows
are matched to values in a location_field: if there is only one location
field, it will be used automatically; otherwise, the specific field must
be provided.
add_locations(
obj,
location_field = NULL,
location_table = NULL,
gazetteer_info = FALSE
)
An existing object of class safedata
The name of a location field in a
safedata
object.
An existing location table for a dataset,
as generated by get_locations
.
Should all the gazetteer fields be included in
the returned sf
object. See
load_gazetteer
for details.
A modified safedata
object including geometry data.
set_example_safe_dir()
#> Loading and caching index
#> Validating directory
beetle_abund <- load_safe_data(1400562, "Ant-Psel")
beetle_abund <- add_locations(beetle_abund)
unset_example_safe_dir()