Last chance! 50% off unlimited learning
Sale ends in
Computes the ‘disc’ of given radius and centre in a linear network.
lineardisc(L, x = locator(1), r, plotit = TRUE,
cols=c("blue", "red","green")) countends(L, x = locator(1), r, toler=NULL, internal=list())
Linear network (object of class "linnet"
).
Location of centre of disc.
Either a point pattern (object of class "ppp"
)
containing exactly 1 point, or a numeric vector of length 2.
Radius of disc.
Logical. Whether to plot the disc.
Colours for plotting the disc. A numeric or character vector of length 3 specifying the colours of the disc centre, disc lines and disc endpoints respectively.
Optional. Distance threshold for countends
. See Details.
There is a sensible default.
Argument for internal use by the package.
The value of lineardisc
is a list with two entries:
Line segment pattern (object of class "psp"
)
representing the interior disc
Point pattern (object of class "ppp"
)
representing the relative boundary of the disc.
The ‘disc’
The relative boundary of the disc
The function lineardisc
computes the
disc of radius countends
simply counts the number of
points in the relative boundary.
Note that countends
requires the linear network L
to be given in the non-sparse matrix format (see the argument
sparse
in linnet
or as.linnet
)
while lineardisc
accepts both sparse and non-sparse formats.
The optional threshold toler
is used to suppress numerical
errors in countends
.
If the distance from r-toler
and r+toler
, the vertex
will be treated as lying on the relative boundary.
Ang, Q.W. (2010) Statistical methodology for events on a network. Master's thesis, School of Mathematics and Statistics, University of Western Australia.
Ang, Q.W., Baddeley, A. and Nair, G. (2012) Geometrically corrected second-order analysis of events on a linear network, with applications to ecology and criminology. Scandinavian Journal of Statistics 39, 591--617.
# NOT RUN {
# letter 'A'
v <- ppp(x=(-2):2, y=3*c(0,1,2,1,0), c(-3,3), c(-1,7))
edg <- cbind(1:4, 2:5)
edg <- rbind(edg, c(2,4))
letterA <- linnet(v, edges=edg)
lineardisc(letterA, c(0,3), 1.6)
# count the endpoints
countends(letterA, c(0,3), 1.6)
# cross-check (slower)
en <- lineardisc(letterA, c(0,3), 1.6, plotit=FALSE)$endpoints
npoints(en)
# }
Run the code above in your browser using DataLab