# Spatially Explicit Capture–Recapture for Linear Habitats

### Description

An secr add-on package for linear habitat models.

### Details

Package: | secr |

Type: | Package |

Version: | 1.0.5 |

Date: | 2015-01-11 |

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 that`secr.fit`

uses 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**. http://igraph.org.

Pebesma, E.J. and Bivand, R. S. (2005) Classes and methods for spatial
data in R. *R News* **5**(**2**), http://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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ```
## 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
olddir <- setwd(system.file("extdata", package = "secrlinear"))
on.exit(setwd(olddir))
arvicola <- read.capthist("Jun84capt.txt", "glymetrap.txt",
detector = "multi", covname = "sex")
## Import map of linear habitat
## -- from text file of x-y coordinates
glymemask <- read.linearmask(file = "glymemap.txt", spacing = 4)
## -- from a previously constructed SpatialLinesDataFrame
library(maptools)
SLDF <- readShapeSpatial("glymemap")
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
``` |