Briefly, I am going to do the Voronoi tessellation of 100 points, and create different sets of 100 points 1000 times and do the tessellation for each set of the points.
I created points as,
x=matrix(runif(100*1000),nrow=100,ncol=1000)
y=matrix(runif(100*1000),nrow=100,ncol=1000)
Basic code to perform Voronoi tessellation using spatstat
package is
dir = ppp(x=x, y=y, window = square(c(0,1)))
tess = dirichlet(dir)
plot(tess, main = "")
points(dir, pch=19, cex = 0.5)
However, I need to do the Voronoi tessellation for 1000 samples and trying to create a loop. I want to choose each column of x and y and end up with 1000 'dir'. Then do the tessellation 'tess' for 1000 'dir'. Also I need to calculate the areas of voronoi cells using the function area=tile.areas(tess)
The loop that I created was
for (i in 1000) {
dir[i] = ppp(x=x[,i], y=y[,i], window = square(c(0,1)))
}
but all I get is errors and warnings. Do you have any idea how to do it?