# Simulate a point pattern with two types
X <- rpoispp(5)
PointType <- sample(c("A", "B"), X$n, replace=TRUE)
PointWeight <- runif(X$n, min=1, max=10)
X$marks <- data.frame(PointType, PointWeight)
X <- as.wmppp(X)
autoplot(X, main="Original pattern")
# Randomize it
Y <- rRandomPositionK(X)
# Points are randomly distributed
autoplot(Y, main="Randomized pattern")
Run the code above in your browser using DataLab