Learn R Programming

riverdist (version 0.16.3)

mouthdistbysurvey: Distance From Mouth for All Observations of Individuals

Description

Calculates distance from the mouth of a river network to all observations of each individual (given as segment and vertex). and the specified mouth of the river network. The mouth must first be specified (see setmouth). Returns a matrix of distances, with a row for each unique individual and a column for each survey.

A plotting method is provided for the output; see plotseq.

Usage

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

Value

A vector of river network distances (numeric), with each row corresponding to a unique fish and each column corresponding to a unique survey. Values of NA indicate the individual not being located during the survey in question.

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)

vert

A vector pf rover coordinates (vertex)

rivers

The river network object to use

logical

A boolean vector that can be used for subsetting - if used, mouthdistbysurvey() will only return 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.

Author

Matt Tyers

See Also

plotseq

Examples

Run this code
data(Gulk, fakefish)

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

Run the code above in your browser using DataLab