# (1) Splitting by marks
# 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
# using cut.ppp
long3 <- cut(longleaf, breaks=3)
# now split them
long3split <- split(long3)
# (2) Splitting by a factor
# Unmarked point pattern
data(swedishpines)
# cut & split according to nearest neighbour distance
f <- cut(nndist(swedishpines), 3)
u <- split(swedishpines, f)
# (3) Splitting over a tessellation
tes <- tess(xgrid=seq(0,96,length=5),ygrid=seq(0,100,length=5))
v <- split(swedishpines, tes)
Run the code above in your browser using DataLab