matbysurveylist: Generate List of Distance Matrix Between Observations, for...

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/apps_of_direction.R

Description

Returns a list of matrices, each giving the river distance, direction, or upstream travel distance between all observations of one unique fish. This function is principally intended for producing an object to plot in plotmatbysurveylist.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
matbysurveylist(
  unique,
  survey,
  seg,
  vert,
  rivers,
  indiv = NULL,
  method = "upstream",
  flowconnected = FALSE,
  net = FALSE,
  stopiferror = TRUE,
  algorithm = NULL
)

Arguments

unique

A vector of unique 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.

indiv

A vector of unique individuals to use. Accepting the default (NULL) will result in a matrix being returned for all unique individuals.

method

Which general method to use. Setting method="distance" will compute distance for each pair of observation, setting method="direction" will compute direction between each pair of observation, and setting method="upstream" will compute directional (upstream) distance between each pair of observation. Defaults to "upstream".

flowconnected

Optional parameter to pass to the distance or direction calculation. Defaults to FALSE.

net

Optional parameter to pass to the distance or direction calculation. Defaults to FALSE.

stopiferror

Optional parameter to pass to the distance or direction calculation. Defaults to TRUE.

algorithm

Optional parameter to pass to the distance or direction calculation. Defaults to NULL.

Value

A list with each element corresponding to a unique fish. Each list element is the output from either riverdistancematbysurvey, riverdirectionmatbysurvey, or upstreammatbysurvey.

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, riverdirection, upstream, riverdistancematbysurvey, riverdirectionmatbysurvey, upstreammatbysurvey, plotmatbysurveylist

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(Gulk, smallset)
matbysurveylist <- matbysurveylist(unique=smallset$id, survey=smallset$flight, seg=smallset$seg, 
   vert=smallset$vert, rivers=Gulk)
plotmatbysurveylist(matbysurveylist)
plotmatbysurveylist(matbysurveylist,type="confint")
plotmatbysurveylist(matbysurveylist,type="dotplot")
   
data(fakefish)
# matbysurveylist <- matbysurveylist(unique=fakefish$fish.id, survey=fakefish$flight, 
#   seg=fakefish$seg, vert=fakefish$vert, rivers=Gulk)
# plotmatbysurveylist(matbysurveylist)

riverdist documentation built on Sept. 10, 2021, 9:06 a.m.