# NOT RUN {
plot(redwood, main="thinning")
# delete 20% of points
Y <- rthin(redwood, 0.8)
points(Y, col="green", cex=1.4)
# function
f <- function(x,y) { ifelse(x < 0.4, 1, 0.5) }
Y <- rthin(redwood, f)
# pixel image
Z <- as.im(f, Window(redwood))
Y <- rthin(redwood, Z)
# pattern on a linear network
A <- runiflpp(30, simplenet)
B <- rthin(A, 0.2)
g <- function(x,y,seg,tp) { ifelse(y < 0.4, 1, 0.5) }
B <- rthin(A, linfun(g, simplenet))
# thin other kinds of patterns
E <- rthin(osteo$pts[[1]], 0.6)
L <- rthin(copper$Lines, 0.5)
# }
Run the code above in your browser using DataLab