Returns a matrix of directions traveled by unique fish between sequential surveys. The mouth (lowest point) segment and vertex must be specified (see setmouth).
riverdirectionseq(unique, survey, seg, vert, rivers, logical = NULL, flowconnected = FALSE, stopiferror = TRUE, algorithm = NULL)
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,
|
flowconnected | If |
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 ( |
A data frame of directions (character), with rows defined by unique fish and columns defined by observation increment (1 to 2, 2 to 3, etc.) See riverdirection for additional information.
Building routes from the river mouth to each river network segment and/or distance lookup tables will greatly reduce computation time (see buildsegroutes).
data(Gulk, fakefish) # Mouth must be specified Gulk$mouth$mouth.seg <- 1 Gulk$mouth$mouth.vert <- 1 riverdirectionseq(unique=fakefish$fish.id, survey=fakefish$flight, seg=fakefish$seg, vert=fakefish$vert, rivers=Gulk)#> 1 to 2 2 to 3 3 to 4 4 to 5 5 to 6 6 to 7 7 to 8 8 to 9 9 to 10 #> 1 up <NA> <NA> up <NA> <NA> <NA> down down #> 3 <NA> up <NA> <NA> up down down down down #> 4 <NA> up <NA> <NA> down up <NA> <NA> <NA> #> 6 <NA> <NA> <NA> <NA> <NA> down <NA> <NA> <NA> #> 7 up up up down <NA> <NA> <NA> <NA> <NA> #> 8 <NA> <NA> <NA> <NA> <NA> <NA> down down down #> 9 up up down <NA> <NA> <NA> <NA> <NA> <NA> #> 10 <NA> <NA> <NA> up <NA> <NA> <NA> down <NA> #> 11 <NA> <NA> <NA> <NA> <NA> <NA> <NA> down up #> 13 <NA> <NA> <NA> up up down <NA> <NA> <NA> #> 14 <NA> <NA> up up down down <NA> <NA> down #> 15 <NA> up <NA> <NA> down <NA> <NA> <NA> <NA> #> 16 <NA> <NA> <NA> <NA> <NA> <NA> down up down #> 17 <NA> <NA> <NA> <NA> up <NA> <NA> <NA> <NA> #> 18 <NA> up up <NA> <NA> <NA> <NA> <NA> <NA> #> 19 <NA> <NA> <NA> <NA> <NA> <NA> <NA> down <NA> #> 20 <NA> <NA> <NA> <NA> up down down <NA> <NA>riverdirectionseq(unique=fakefish$fish.id, survey=fakefish$flight.date, seg=fakefish$seg, vert=fakefish$vert, rivers=Gulk)#> 2015-04-01 to 2015-04-19 2015-04-19 to 2015-06-01 2015-06-01 to 2015-06-21 #> 1 up <NA> <NA> #> 3 <NA> up <NA> #> 4 <NA> up <NA> #> 6 <NA> <NA> <NA> #> 7 up up up #> 8 <NA> <NA> <NA> #> 9 up up down #> 10 <NA> <NA> <NA> #> 11 <NA> <NA> <NA> #> 13 <NA> <NA> <NA> #> 14 <NA> <NA> up #> 15 <NA> up <NA> #> 16 <NA> <NA> <NA> #> 17 <NA> <NA> <NA> #> 18 <NA> up up #> 19 <NA> <NA> <NA> #> 20 <NA> <NA> <NA> #> 2015-06-21 to 2015-07-07 2015-07-07 to 2015-08-11 2015-08-11 to 2015-09-05 #> 1 up <NA> <NA> #> 3 <NA> up down #> 4 <NA> down up #> 6 <NA> <NA> down #> 7 down <NA> <NA> #> 8 <NA> <NA> <NA> #> 9 <NA> <NA> <NA> #> 10 up <NA> <NA> #> 11 <NA> <NA> <NA> #> 13 up up down #> 14 up down down #> 15 <NA> down <NA> #> 16 <NA> <NA> <NA> #> 17 <NA> up <NA> #> 18 <NA> <NA> <NA> #> 19 <NA> <NA> <NA> #> 20 <NA> up down #> 2015-09-05 to 2015-09-20 2015-09-20 to 2015-10-29 2015-10-29 to 2015-11-25 #> 1 <NA> down down #> 3 down down down #> 4 <NA> <NA> <NA> #> 6 <NA> <NA> <NA> #> 7 <NA> <NA> <NA> #> 8 down down down #> 9 <NA> <NA> <NA> #> 10 <NA> down <NA> #> 11 <NA> down up #> 13 <NA> <NA> <NA> #> 14 <NA> <NA> down #> 15 <NA> <NA> <NA> #> 16 down up down #> 17 <NA> <NA> <NA> #> 18 <NA> <NA> <NA> #> 19 <NA> down <NA> #> 20 down <NA> <NA>