title: How to do Voronoi tessellation of 100 points on a unit square multiple times
body: <p>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. </p>
  
  <p>I created points as,</p>
  
  <pre><code>x=matrix(runif(100*1000),nrow=100,ncol=1000)
  y=matrix(runif(100*1000),nrow=100,ncol=1000)
  </code></pre>
  
  <p>Basic code to perform Voronoi tessellation using <code>spatstat</code> package is</p>
  
  <pre><code>dir = ppp(x=x, y=y, window = square(c(0,1)))
  tess = dirichlet(dir)
  plot(tess, main = "")
  points(dir, pch=19, cex = 0.5)
  </code></pre>
  
  <p>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 <code>area=tile.areas(tess)</code></p>
  
  <p>The loop that I created was</p>
  
  <pre><code>for (i in 1000) {
    dir[i] = ppp(x=x[,i], y=y[,i], window = square(c(0,1)))
  }
  </code></pre>
  
  <p>but all I get is errors and warnings. Do you have any idea how to do it?</p>