## 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 / kmRun the code above in your browser using DataLab