| secrlinear-package {secrlinear} | R Documentation |
Spatially Explicit Capture–Recapture for Linear Habitats
Description
An secr add-on package for linear habitat models.
Details
| Package: | secrlinear |
| Type: | Package |
| Version: | 1.2.2 |
| Date: | 2023-10-17 |
| License: | GNU General Public License Version 2 or later |
The important functions in secrlinear are:
read.linearmask | import and discretize a linear habitat map (route) |
networkdistance | compute network distances between detectors and points using a linear habitat mask |
sim.linearpopn | simulate population along linear mask |
make.line | place detectors along (part of) a linear route |
Other useful functions are:
checkmoves | check capthist object for extreme movements |
showpath | interactive examination of network distances |
clipmask | drop mask points outside buffer distance |
rbind.linearmask | combine two linear masks |
subset.linearmask | select part of a linear mask |
asgraph | convert linear mask to igraph |
snapPointsToLinearMask | closest point on graph |
make.sldf | convert coordinates to SpatialLinesDataFrame |
Documentation is provided in a vignette ../doc/secrlinear-vignette.pdf and in the pdf version of the help pages ../doc/secrlinear-manual.pdf
The package draws on the packages sp (Pebesma and Bivand 2005) and igraph (Csardi and Nepusz 2006).
In order to fit a linear-habitat model with the secr function secr.fit:
specify a linear mask for the ‘mask’ argument
specify
details = list(userdist = networkdistance)so thatsecr.fituses network distances rather than Euclidean distances.
An example dataset arvicola is drawn from trapping of water voles Arvicola amphibius in June 1984 along the River Glyme in the U.K. – the relevant linear mask is glymemask.
A more complex linear network (Silverstream) is provided as an ESRI shapefile.
Author(s)
Murray Efford murray.efford@otago.ac.nz
References
Csardi, G. and Nepusz, T. (2006) The igraph software package for complex network research. InterJournal, Complex Systems 1695. https://igraph.org/.
Pebesma, E.J. and Bivand, R. S. (2005) Classes and methods for spatial data in R. R News 5(2), https://cran.r-project.org/doc/Rnews/.
See Also
addedges,
asgraph,
checkmoves,
clipmask,
deleteedges,
linearmask,
linearpopn,
make.line,
make.sldf,
networkdistance,
plot.linearmask,
rbind.linearmask ,
read.linearmask,
showpath,
showedges,
sim.linearpopn,
snapPointsToLinearMask,
subset.linearmask
Examples
## Water voles in June 1984 on the R. Glyme in Oxfordshire, UK
## capture and trap location files are exactly as for a 2-D analysis
inputdir <- system.file("extdata", package = "secrlinear")
arvicola <- read.capthist(captfile = paste0(inputdir, "/Jun84capt.txt"),
trapfile = paste0(inputdir, "/glymetrap.txt"), detector = "multi",
covname = "sex")
## Import map of linear habitat
## -- from text file of x-y coordinates
glymemask <- read.linearmask(file = paste0(inputdir, "/glymemap.txt"), spacing = 4)
## -- from a previously constructed SpatialLinesDataFrame
SLDF <- as(sf::st_read(paste0(inputdir,"/glymemap.shp")), 'Spatial')
glymemask <- read.linearmask(data = SLDF, spacing = 4)
## display the mask and capture data
plot (glymemask)
plot(arvicola, add = TRUE, tracks = TRUE)
plot(traps(arvicola), add = TRUE)
## fit model, estimate density
linearfit <- secr.fit(arvicola, mask = glymemask, trace = FALSE,
details = list(userdist = networkdistance))
predict(linearfit)
## NOTE : the unit of density (D) is animals / km