riverdistanceseq: River Distance Between Sequential Observations

View source: R/apps_of_riverdistance.R

riverdistanceseqR Documentation

River Distance Between Sequential Observations

Description

Returns a matrix of distances traveled by unique fish, between sequential surveys. A plotting method is also provided for the output; see plotseq

Usage

riverdistanceseq(
  unique,
  survey,
  seg,
  vert,
  rivers,
  logical = NULL,
  stopiferror = TRUE,
  algorithm = NULL
)

Arguments

unique

A vector of identifiers for each fish.

survey

A vector of identifiers for each survey. It is recommended to use a numeric or date format (see as.Date) to preserve survey order.

seg

A vector of river locations (segment component).

vert

A vector of river locations (vertex component).

rivers

The river network object to use.

logical

A boolean vector that can be used for subsetting. If used, riverdistanceseq() will only return pairwise distances in which a specified condition is met.

stopiferror

Whether or not to exit with an error if a route cannot be found. If this is set to FALSE and a route cannot be found, the function will return NA in the appropriate entry. Defaults to TRUE. See detectroute.

algorithm

Which route detection algorithm to use ("Dijkstra", "sequential", or "segroutes"). If left as NULL (the default), the function will automatically make a selection. See detectroute for more details.

Value

A data frame of distances (numeric), with rows defined by unique fish and columns defined by observation increment (1 to 2, 2 to 3, etc.)

Note

Building routes from the river mouth to each river network segment and/or distance lookup tables will greatly reduce computation time (see buildsegroutes).

Author(s)

Matt Tyers

See Also

riverdistance, plotseq

Examples

data(Gulk, fakefish)
riverdistanceseq(unique=fakefish$fish.id, survey=fakefish$flight,
      seg=fakefish$seg, vert=fakefish$vert, rivers=Gulk)
     
seqbysurvey <- riverdistanceseq(unique=fakefish$fish.id, survey=fakefish$flight.date,
      seg=fakefish$seg, vert=fakefish$vert, rivers=Gulk)
seqbysurvey
plotseq(seqbysurvey)

mbtyers/riverdist documentation built on Jan. 16, 2024, 12:34 a.m.