[R-sig-Geo] center of gravity

Roger Bivand Roger.Bivand at nhh.no
Sat Sep 1 00:56:27 CEST 2007


On Fri, 31 Aug 2007, Rick Reeves wrote:

> Hi: look for Centroid calculations:
>
>> help.search("centroid") will show:
>
> Help files with alias or concept or title matching 'centroid' using fuzzy 
> matching:
>
>
>
> apply.polygon(maps)                        Polygon functions
> get.Pcent(maptools)                        Polygon centroids
> calcCentroid(PBSmapping)                   Calculate the Centroids of 
> Polygons
> centroid.owin(spatstat)                    Centroid of a window
> affinexy(spatstat)                         Internal spatstat functions
>
> I suspect that the best one for your case would be centroid.owin, since it 
> has the most
> straightforward input data requirements.

I agree, but am not sure that the question is about centroids. It might be 
the "centre" of a point pattern, where the highest density location(s) 
would not often be the centroid of the convex hull. If the data are 
SpatialPolygons read using readShapePoly() or readOGR(), the coordnates() 
method for the imported object returns a matrix of label points, which are 
the centroids of the largest member Polygon object of each Polygons 
object, so they can be retrieved without any more trouble, but I'm not 
sure that the points needed are area weighted.

Roger

>
> Hope this helps,
> Rick Reeves
>
>

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