upstreammatbysurvey {riverdist} | R Documentation |
Upstream Distance Matrix of All Observations of an Individual
Description
Returns a matrix of upstream travel distance between all observations of one unique fish.
Usage
upstreammatbysurvey(
indiv,
unique,
survey,
seg,
vert,
rivers,
full = TRUE,
flowconnected = FALSE,
net = FALSE,
stopiferror = TRUE,
algorithm = NULL
)
Arguments
indiv |
The unique identifier of the fish in question. |
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. |
full |
Whether to return the full matrix, with |
flowconnected |
If |
net |
Whether to calculate net upstream distance (net=TRUE) or total distance (net=FALSE, default). |
stopiferror |
Whether or not to exit with an error if a route cannot be
found. If this is set to |
algorithm |
Which route detection algorithm to use ( |
Value
A matrix of upstream distances (numeric), with rows and columns defined by
survey. In the resulting matrix, the element with the row identified as
A
and column identified as B
is defined as the upstream distance
traveled from survey A to survey B. Therefore, it is likely that only the
upper triangle of the matrix will be of interest.
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
Examples
data(Gulk, fakefish)
upstreammatbysurvey(indiv=1, unique=fakefish$fish.id, survey=fakefish$flight,
seg=fakefish$seg, vert=fakefish$vert, rivers=Gulk)
upstreammatbysurvey(indiv=1, unique=fakefish$fish.id, survey=fakefish$flight,
seg=fakefish$seg, vert=fakefish$vert, rivers=Gulk, full=FALSE)