[R-sig-Geo] Simple and Efficient way to Divide Study Area?

Roger Bivand Roger.Bivand at nhh.no
Sun Jun 24 18:26:54 CEST 2007


On Sun, 24 Jun 2007, Kitty Lee wrote:

> 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?

Please do note what I wrote in my earlier reply, of 20 June, use deldir 
not tripack. Then read the thread referenced from:

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/96588.html

for the reamaining questions.

Roger

>
> 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]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list