add_locations: Adds location data to a SAFE data worksheet.

View source: R/locations.R

add_locationsR Documentation

Adds location data to a SAFE data worksheet.

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

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

   set_example_safe_dir()
   beetle_abund <- load_safe_data(1400562, "Ant-Psel")
   beetle_abund <- add_locations(beetle_abund)
   unset_example_safe_dir()

safedata documentation built on April 25, 2022, 5:05 p.m.