mergeSites: Function to merge sites

View source: R/GeoLight.R

mergeSitesR Documentation

Function to merge sites

Description

The changeLight functions provides a vector grouping the twilight times into stationary (>0) and movement (0) periods. This function was written to enable the user to merge sites based on the distance between consequtive sites. NOTE: The function requires position estimate and desicison on whether sites should be merged will be made based on the defined distance, the cutoff values and the provided positions. The analysis is this dependent on the accuracy of the position estiamtes and should be applied to positons that were estimated using a sensible sun elevation angle.

Usage

mergeSites(
  tFirst,
  tSecond,
  type,
  twl,
  site,
  degElevation,
  distThreshold = 250,
  fixed = NULL,
  alpha = c(0, 15),
  plot = TRUE
)

Arguments

tFirst

vector of sunrise/sunset times (e.g. 2008-12-01 08:30).

tSecond

vector of of sunrise/sunset times (e.g. 2008-12-01 17:30).

type

vector of either 1 or 2, defining tFirst as sunrise or sunset respectively.

twl

data.frame containing twilights and at least tFirst, tSecond and type

site

a numerical vector assigning each row to a particular period. Stationary periods in numerical order and values >0, migration/movement periods 0. This vector will be used as the initial state.

degElevation

the sun elevation angle (in degrees) that defines twilight (e.g. -6 for "civil twilight"). Either a single value, a vector with the same length as tFirst or nrow(x).

distThreshold

a numerical value defining the threshold of the distance under which consequtive sites should be merged (in km).

fixed

...

alpha

mean and standard variation for position optimization process.

plot

logical, if TRUE a plot comparing the inital and the final site selection.

Value

A vector with the merged site numbers

Author(s)

Simeon Lisovski


slisovski/GeoLight documentation built on Feb. 29, 2024, 2:10 p.m.