[R-sig-Geo] ordering of data in polygons shapefile

Franziska Schulze franziska.schulze at wiwi.hu-berlin.de
Wed Jan 19 11:16:34 CET 2011


I see, the problem is that the other data is properly ordered but the 
shape file is not properly ordered. So, I should mimic the strange 
ordering of the shapefile in my other data than. I think, I will do 
this. Thank you!


Am 19.01.2011 11:12, schrieb Roger Bivand:
> On Wed, 19 Jan 2011, Franziska Schulze wrote:
>
>> Hallo,
>>
>> I still have another question:
>>
>> I have a polygon shapefile and I want to use it in order to construct 
>> my neighbors object and listw object to perform spatial econometric 
>> tests and to estimate a spatial model. The problem ist that the 
>> regions in my shapefile are not ordered as they should be in order to 
>> match with the other variables. Therefore, my question is whether it 
>> is possible to order a spatial polygons data frame with respect to 
>> one of its attributes. (The attribute is a region id number which has 
>> to ordered in increasing order.)
>
> Yes, it is possible, but it is better practice and much easier to 
> reorder the other data, and add it with spCbind() in maptools to the 
> SpatialPolygonsDataFrame object. You need to make sure that the match 
> between the row.names() of the SpatialPolygonsDataFrame object and the 
> row.names() of the additional data stored as a data.frame object is 
> exact. Look at the example for ?spCbind for further details. 
> Re-ordering a data.frame object is a standard operation in R.
>
> Hope this helps,
>
> Roger
>
>>
>> Thanks in advance!
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>


-- 
Dipl.-Vw. Franziska Schulze

Wissenschaftliche Mitarbeiterin

Humboldt-Universität zu Berlin
Wirtschaftswissenschaftliche Fakultät
Lehrstuhl für Ökonometrie

Spandauer Str. 1
10178 Berlin
Tel.: 0049-(0)30-2093 5705
http://www2.hu-berlin.de/oekonometrie/



More information about the R-sig-Geo mailing list