data(longleaf)
# Longleaf pines data
plot(longleaf)
<testonly>longleaf <- longleaf[seq(1,longleaf$n,by=10)]</testonly>
# adult trees defined to have diameter at least 30 cm
adult <- (longleaf$marks >= 30)
longadult <- longleaf[adult]
# equivalent to: longadult <- subset.ppp(longleaf, subset=adult)
plot(longadult)
# note that the marks are still retained.
# Use unmark(longadult) to remove the marks
# New Zealand trees data
data(nztrees)
plot(nztrees) # plot shows a line of trees at the far right
abline(v=148, lty=2) # cut along this line
nzw <- owin(c(0,148),c(0,95)) # the subwindow
# trim dataset to this subwindow
nzsub <- nztrees[,nzw]
# equivalent to: nzsub <- subset.ppp(nztrees, window=nzw)
plot(nzsub)
# Redwood data
data(redwood)
plot(redwood)
# Random thinning: delete 60\% of data
retain <- (runif(redwood$n) < 0.4)
thinred <- redwood[retain]
plot(thinred)
# Scramble 60\% of data
modif <- (runif(redwood$n) < 0.6)
scramble <- function(x) { runifpoint(x$n, x$window) }
redwood[modif] <- scramble(redwood[modif])
# Lansing woods data - multitype points
data(lansing)
<testonly>lansing <- lansing[seq(1, lansing$n, length=100)]</testonly>
# hickory trees only
hick <- lansing[lansing$marks == "hickory", ]
# still a marked pattern -- remove marks
hick <- unmark(hick)
# scramble the hickories
lansing[lansing$marks == "hickory"] <- scramble(hick)
Run the code above in your browser using DataLab