## S3 method for class 'ppx':
split(x, f = marks(x), drop=FALSE, un=NULL, ...)
"ppx"
.f
.
The list also has the class "splitppx"
and "listof"
.split
allows a dataset to be separated
into subsets according to the value of a grouping variable.
The function split.ppx
is a method for the generic
split
for the class "ppx"
of multidimensional
point patterns. It 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
x
.
The levels off
determine the destination of each point inx
.
Thei
th point ofx
will be placed in the sub-patternsplit.ppx(x)$l
wherel = f[i]
.marks(x)
is a data frame. This column should
be a factor.f
is missing, then it will be determined by the
marks of the point pattern. The pattern x
can be either
f
is taken to be the marks vector.
The effect is that the points of each type
are separated into different point patterns.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.ppx
has class "splitppx"
and "listof"
. There are methods for print
,
summary
and plot
.
ppx
,
plot.listof
df <- data.frame(x=runif(4),y=runif(4),t=runif(4),
age=rep(c("old", "new"), 2),
size=runif(4))
X <- ppx(data=df, coord.type=c("s","s","t","m","m"))
X
split(X)
Run the code above in your browser using DataLab