Divide Point Pattern into Sub-patterns
Divides a point pattern into several sub-patterns, according to their marks, or according to any user-specified grouping.
## S3 method for class 'ppp': split(x, f = x$marks, drop=FALSE, un=missing(f), ...) ## S3 method for class 'ppp': split(x, f = x$marks, drop=FALSE, un=missing(f), ...) <- value
- A two-dimensional point pattern.
An object of class
- Factor determining the grouping.
- Logical. Determines whether empty groups will be deleted.
- Logical. Determines whether subpatterns will be unmarked (i.e. whether marks will be removed from the points in each subpattern).
- Other arguments are ignored.
- List of point patterns.
divides up the points of the point pattern
into several sub-patterns according to the levels of the factor
f. The result is a list of point patterns, one for each
f is present, it must be a factor, and its length
must equal the number of points in
x. The levels of
determine the destination of each point in
ith point of
x will be placed in the sub-pattern
l = f[i].
f is missing, then
x must be a multitype point pattern
(a marked point pattern whose marks vector is a factor).
Then the effect is that the points of each type
are separated into different point patterns.
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.
un determines how to handle marks
in the case where
x is a marked point pattern.
un=TRUE then the marks of the
points will be discarded when they are split into groups,
un=FALSE then the marks will be retained.
The result of
split.ppp has class
and can be plotted using
The assignment function
updates the point pattern
x so that
split(x, f, drop, un) = value. The argument
is expected to be a list of point patterns, one for each level of
f. These point patterns are expected to be compatible in the sense
that they all have the same window, and either they are all unmarked
or they all have marks of the same kind.
Splitting can also be undone by the function
- The value of
split.pppis a list of point patterns. The components of the list are named by the levels of
The assignment form
split<-.pppreturns the updated point pattern
## S3 method for class 'ppp': split(x, f = x$marks, drop=FALSE, un=NULL, \dots) ## S3 method for class 'ppp': split(x, f = x$marks, drop=FALSE, un=missing(f), ...) <- value
# Multitype point pattern: separate into types data(amacrine) u <- split(amacrine) # plot them plot(split(amacrine)) # the following are equivalent: amon <- split(amacrine)$on amon <- unmark(amacrine[amacrine$marks == "on"]) # the following are equivalent: amon <- split(amacrine, un=FALSE)$on amon <- amacrine[amacrine$marks == "on"] # Scramble the locations of the 'on' cells u <- split(amacrine) u$on <- runifpoint(amon$n, amon$window) split(amacrine) <- u # Point pattern with continuous marks data(longleaf) <testonly># smaller dataset longleaf <- longleaf[seq(1, longleaf$n, by=80)]</testonly> # cut the range of tree diameters into three intervals long3 <- cut.ppp(longleaf, 3) # now split them long3split <- split(long3) # Unmarked point pattern data(swedishpines) # cut & split according to nearest neighbour distance f <- cut(nndist(swedishpines), 3) u <- split(swedishpines, f)