add_locations: Adds location data to a SAFE data worksheet.

Description Usage Arguments Value See Also Examples

Description

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.

Usage

1
2
add_locations(obj, location_field = NULL, location_table = NULL,
  gazetteer_info = FALSE)

Arguments

obj

An existing object of class safedata

location_field

The name of a location field in a safedata object.

location_table

An existing location table for a dataset, as generated by get_locations.

gazetteer_info

Should all the gazetteer fields be included in the returned sf object. See load_gazetteer for details.

Value

A modified safedata object including geometry data.

See Also

get_locations, load_gazetteer, load_location_aliases

Examples

1
2
3
4
   safedir <- system.file('example_data_dir', package='safedata')
   set_safe_dir(safedir, update=FALSE, validate=FALSE)
   beetle_abund <- load_safe_data(1400562, 'Ant-Psel')
   beetle_abund <- add_locations(beetle_abund)

ImperialCollegeLondon/safe_data documentation built on Oct. 8, 2019, 4:27 p.m.