For a point pattern on a linear network, classify the points into distinct types according to the numerical marks in the pattern, or according to another variable.
# S3 method for lpp
cut(x, z=marks(x), ...)A point pattern on a linear network
(object of class "lpp").
Data determining the classification. A numeric vector,
a factor, a pixel image on a linear network (class "linim"),
a function on a linear network (class "linfun"),
a tessellation on a linear network (class "lintess"), a string
giving the name of a column of marks, or one of the coordinate
names "x", "y", "seg" or "tp".
Arguments passed to cut.default.
They determine the breakpoints for the mapping from numerical values
in z to factor values in the output.
See cut.default.
A multitype point pattern on the same linear network,
that is, a point pattern object
(of class "lpp") with a marks vector that is a factor.
This function has the effect of classifying each point in the point
pattern x into one of several possible types. The
classification is based on the dataset z, which may be either
a factor (of length equal to the number of points in z)
determining the classification of each point in x.
Levels of the factor determine the classification.
a numeric vector (of length equal to the number of points in
z). The range of values of z will be divided into
bands (the number of bands is determined by …)
and z will be converted to a factor using
cut.default.
a pixel image on a network (object of class "linim").
The value of z at each point of x will be
used as the classifying variable.
a function on a network (object of class "linfun", see
linfun).
The value of z at each point of x will be
used as the classifying variable.
a tessellation on a network (object of class "lintess", see
lintess). Each point of x will be classified
according to the tile of the tessellation into which it falls.
a character string, giving the name of one of the columns
of marks(x), if this is a data frame.
a character string identifying one of the coordinates:
the spatial coordinates
"x", "y" or the segment identifier "seg"
or the fractional coordinate along the segment, "tp".
The default is to take z to be the vector of marks in
x (or the first column in the data frame of marks of x,
if it is a data frame). If the marks are numeric, then the range of values
of the numerical marks is divided into several intervals, and each
interval is associated with a level of a factor.
The result is a
marked point pattern, on the same linear network,
with the same point locations as
x, but with the numeric mark of each point discretised
by replacing it by the factor level.
This is a convenient way to transform a marked point pattern
which has numeric marks into a multitype point pattern,
for example to plot it or analyse it. See the examples.
To select some points from x, use the subset operators
[.lpp or subset.lpp instead.
# NOT RUN {
X <- runiflpp(20, simplenet)
f <- linfun(function(x,y,seg,tp) { x }, simplenet)
plot(cut(X, f, breaks=4))
plot(cut(X, "x", breaks=4))
plot(cut(X, "seg"))
# }
Run the code above in your browser using DataLab