[R-sig-Geo] a problem with creating a neighbours list

stevenhuyi stevenhuyi at gmail.com
Tue May 26 10:59:30 CEST 2015


Hi everyone,
I have a  simple problem, which I know will have a simple solution, but I
just can't tackle it. 

I have a shapefile with regions, including an attribute containing a
regional id. I used the following R script to create a neighbours list:

anhui <- readShapePoly("endemic.shp")
zzz<- poly2nb(anhui,row.names=anhui$COUNTY_ID)
nb2INLA("anhui.graph", zzz)
Anhui.adj <- paste(getwd(),"/Anhui.graph",sep="")

However, the Anhui.adj file is just as follows
31
1 5 3 4 5 6 7
2 2 3 7
3 3 1 2 7
4 2 1 5
...

the id number is not the original id number in my shapefile (which are
actually 1289, 1290,...). Is there a way to get a neighbours list that is
created using the original id number? Thanks for your help.

Yi




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/a-problem-with-creating-a-neighbours-list-tp7588325.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list