Dear R-users,

I have a study area (with points as observations) and I want to divide the space randomly into sub-regions for further analyses.

I first generated some random points and then used voronoi to divide the space.

ngrp<-20
genx<-runif(ngrp,0,1)
geny<-runif(ngrp,0,1)
genxy<-cbind(genx, geny)
vonout<-voronoi.mosaic(genxy[,1], genxy[,2], 
duplicate="remove")
plot(vonout)
vonpoly<-voronoi.polygons(vonout)
plot(vonpoly)

But there is one major problem with this method--- I wanted to get 20 sub-regions but (in one random run),  only 12 enclosed polygons are returned

My questions are:

1) how can I make the unenclosed areas into enclosed polygons? (so that the whole study area is divided into mutually exclusive and exhaustive sub-regions)

2) is this a good/efficient method? 

After getting all enclosed polygons, I have to 
a) turn this into SPatial PolygonDataFrame; 
b) overlay with the existing points; 
c) find out which polygons these point fall into
d) conduct sub-region analyses

Is there a more efficient method? How can I efficiently
a) divide the study area into specified no. of subgroups? (and they don't have to include equal no. of points)
b) divide the study area into specified no. of subgroups? (each subgroup has the same no. of points)


Thanks!!

K.



       
---------------------------------
Park yourself in front of a world of choices in alternative vehicles.

	[[alternative HTML version deleted]]


