The function split.ppp
divides up the points of the point pattern x
into several sub-patterns according to the values of f
.
The result is a list of point patterns.
The argument f
may be
- a factor, of length equal to the number of points in
x
.
The levels off
determine the destination of each point inx
.
Thei
th point ofx
will be placed in the sub-patternsplit.ppp(x)$l
wherel = f[i]
. - a pixel image (object of class
"im"
) with factor values.
The pixel value off
at each point ofx
will be used as the classifying variable. - a tessellation (object of class
"tess"
).
Each point ofx
will be classified according to
the tile of the tessellation into which it falls. - a window (object of class
"owin"
).
Each point ofx
will be classified according to
whether it falls inside or outside this window. - a character string, matching the name of one of the columns of
marks, if
marks(x)
is a data frame. This column should
be a factor.
If f
is missing, then it will be determined by the
marks of the point pattern. The pattern x
can be either
- a multitype point pattern
(a marked point pattern whose marks vector is a factor).
Then
f
is taken to be the marks vector.
The effect is that the points of each type
are separated into different point patterns. - a marked point pattern with a data frame of marks, containing at least one
column that is a factor. The first such column will be used to
determine the splitting factor
f
.
Some of the sub-patterns created by the split
may be empty. If drop=TRUE
, then empty sub-patterns will
be deleted from the list. If drop=FALSE
then they are retained.
The argument un
determines how to handle marks
in the case where x
is a marked point pattern.
If un=TRUE
then the marks of the
points will be discarded when they are split into groups,
while if un=FALSE
then the marks will be retained.
If f
and un
are both missing,
then the default is un=TRUE
for multitype point patterns
and un=FALSE
for marked point patterns with a data frame of
marks.
The result of split.ppp
has class "splitppp"
and can be plotted using plot.splitppp
.
The assignment function split<-.ppp
updates the point pattern x
so that
it satisfies split(x, f, drop, un) = value
. The argument value
is expected to be a list of point patterns, one for each level of
f
. These point patterns are expected to be compatible with the
type of data in the original pattern x
.
Splitting can also be undone by the function superimpose
.