An object of class linearmask
maps linear habitat, such
as a river, in a way that is useful for spatially explicit
capture–recapture analysis. The object contains two representations
of the linear habitat: as features in a SpatialLinesDataFrame, and
discretized as a set of equally spaced points, as in a mask object
from secr.
Usually the object was created in a call to
read.linearmask
, which performs the discretization given
linear input data and a chosen spacing.
A linearmask object does not explicitly include topological
information i.e. the branching pattern of river networks. Instead, a
network is constructed onthefly in asgraph
by joining
adjacent mask points (those within a certain small Euclidean
distance). This results in 'shortcut' edges where lines approach at an
acute angle (see the Examples for a demonstration).
A more complete, but also more cumbersome, solution for river networks might be to adapt the SpatialStreamNetwork object class of the SSN package (ver Hoef et al. 2014). Data input for SSN requires preprocessing in the proprietary software ArcGIS.
The object itself is a dataframe of coordinates for the points comprising the mask, as for a 2dimensional habitat mask (mask).
Additional information is stored as attributes (these usually remain hidden, but are essential except for ‘graph’):
spacingfactor 
The spacing factor determines which
points in a linear mask are joined to form a linear network, as
happens automatically when computing distances with

SLDF 
The SLDF attribute is a SpatialLinesDataFrame (defined in sp) that provides the underlying description of the linear habitat. 
graph 
igraph network. Optionally computed by 
.
covariates 
A required dataframe of covariate values, including at least the column ‘LineID’ 
Other attributes are common to masks and linearmasks:
spacing 
In this context, the length of habitat in metres that is associated with each mask point (segment length). 
meanSD 
A matrix with mean and standard deviation of coordinates. 
boundingbox 
In this context, a dataframe giving the coordinate ranges spanned by the SLDF. Differs from 2D mask in not being 'buffered' by spacing/2. 
Further attributes of 2dimensional masks (area, polygon etc.) are not
relevant but may be present. The object has class
c("linearmask", "mask", "data.frame")
or c("list",
"linearmask", "mask", "data.frame")
for a multisession linear mask.
Ver Hoef, J. M., Peterson, E. E., Clifford, D. and Shah, R. (2014) SSN : an R package for spatial statistical modeling on stream networks. Journal of Statistical Software 56(3), 1–45.
read.linearmask
, mask
,
showpath
, networkdistance
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  ## make a complex linear mask
x < seq(0, 4*pi, length = 200)
xy < data.frame(x = x*100, y = sin(x)*300)
xy2 < data.frame(x = x*100, y = cos(x)*300)
test < read.linearmask(data = xy, spacing = 10)
test2 < read.linearmask(data = xy2, spacing = 10)
test3 < rbind(test, test2)
## visualize the igraph network used by networkdistance()
tmp < asgraph(test3)
if(require('igraph')) {
i2 < get.edges(tmp,1:ecount(tmp))
plot(test3, linecol = 'white', col = 'grey')
segments(test3[i2[,1],1], test3[i2[,1],2], test3[i2[,2],1],
test3[i2[,2],2], lwd=2, col='blue')
}

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.