split.ppp {spatstat} | R Documentation |
Divides a point pattern into several sub-patterns, according to their marks, or according to any user-specified grouping.
split.ppp(x, f = x$marks) split(x, f) <- value
x |
A two-dimensional point pattern.
An object of class "ppp" .
|
f |
Factor determining the grouping. |
value |
List of point patterns. |
The function split.ppp
divides up the points of the point pattern x
into several sub-patterns according to the levels of the factor
f
. The result is a list of point patterns, one for each
level of f
.
If f
is present, it must be a factor, and its length
must equal the number of points in x
. The levels of f
determine the destination of each point in x
.
The i
th point of x
will be placed in the sub-pattern
split.ppp(x)$l
where l = f[i]
.
If 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.
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) = value
. The argument value
is expected to be a list of point patterns, one for each level of
f
.
Splitting can also be undone by the function superimpose
.
The value of split.ppp
is a list of point patterns.
The components of the list are named by the levels of f
.
The assignment form split<-.ppp
returns the updated
point pattern x
.
Adrian Baddeley adrian@maths.uwa.edu.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner rolf@math.unb.ca http://www.math.unb.ca/~rolf
cut.ppp
,
plot.splitppp
,
superimpose
,
ppp.object
# Multitype point pattern: separate into types data(amacrine) u <- split(amacrine) # the following are equivalent: amon <- amacrine[amacrine$marks == "on"] amon <- split(amacrine)$on # plot them plot(split(amacrine)) # Scramble the 'on' cells u$on <- runifpoint(amon$n, amon$window) split(amacrine) <- u # Point pattern with continuous marks data(longleaf) # 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)