indivsInfo_AssignZones: Assign zones to individuals based on location(s)

View source: R/indivsInfo_AssignZones.R

indivsInfo_AssignZonesR Documentation

Assign zones to individuals based on location(s)

Description

Function to assign zones to individuals based on location(s).

Usage

indivsInfo_AssignZones(
  sf_dfr,
  sf_zones,
  geomNames = c("startGeom", "endGeom"),
  zoneNames = c("startZone", "endZone"),
  keepFirst = TRUE
)

Arguments

sf_dfr

- sf dataframe with point geometries

sf_zones

- sf dataframe with zone information (polygons)

geomNames

- vector of names of geometry column(s) to use for assigning zone(s)

zoneNames

- vector of names of zones to be associated with each geomName

keepFirst

- flag to keep first zone in which a point geometry falls (see Details)

Details

Ideally, sf_zones should consist of non-overlapping polygons so that only one zone can be assigned to each geometry. If a point geometry is in an area of overlap between multiple zones, a record would normally be included in the result for each zone in which the point falls. If keepFirst is TRUE, the record for the first zone in which the point falls is kept. This is also the case if zones are assigned to multiple geomNames. Otherwise, records are added to the result for all zones in which a point falls.

Value

sf_dfr with additional column(s) indicating the zone(s) in which each geometry falls


wStockhausen/rDisMELS documentation built on March 27, 2022, 1 a.m.