
Last chance! 50% off unlimited learning
Sale ends in
rthin(X, P, ...)
"ppp"
)
that will be thinned.X
will be retained.
Either a single number, or a vector of numbers,
or a function(x,y)
, or a pixel image (object of class
"im"
P
, if it is a function."ppp"
).X
is randomly either deleted or retained (i.e. not deleted).
The result is a point pattern,
consisting of those points of X
that were retained.Independent random thinning means that the retention/deletion of each point is independent of other points.
The argument P
determines the probability of retaining
each point. It may be
[object Object],[object Object],[object Object],[object Object]
If P
is a function, it should be x,y
and should yield a
numeric vector of the same length. The function may have extra
arguments which are passed through the ...
argument.
data(redwood)
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, redwood$window)
Y <- rthin(redwood, Z)
Run the code above in your browser using DataLab