[R-sig-Geo] edit.nb problem with an island
Alexander Werner
werner at wirtschaft.uni-kassel.de
Tue May 17 09:45:13 CEST 2011
Dear Marc,
facing a similar problem I choose to correct the NB object manually:
NBDKR439[[350]]= as.integer(sort(c(NBDKR439[[350]],362)))
NBDKR439[[362]]= as.integer(350)
Hope this helps,
Alexander
Am 16.05.2011 19:01, schrieb Marc Marí Dell'Olmo:
> Dear all,
>
> I have a cartography with an island, i.e. a polygon that doesn't share
> border with other polygons (CODIGO=3120104012). I would like to
> manually assign two areas (CODIGO=3120103024 and CODIGO=3120103014) as
> a neighborhood areas of this island with the edit.nb function, and
> after that to obtain the neighborhood matrix. I have followed this
> syntax and I don't understand why the summary(x.nb2) still shows one
> region with no link...
>
> If it helps, you can download the map at:
> http://dl.dropbox.com/u/14934021/map.zip
>
>
> Thank you very much,
>
> Marc
>
> map<-readShapePoly("F:/map/map.shp")
> map<-map[order(map$CODIGO),]
>
>
> x.nb<-poly2nb(map)
> summary(x.nb)
>
> #Neighbour list object:
> #Number of regions: 122
> #Number of nonzero links: 724
> #Percentage nonzero weights: 4.864284
> #Average number of links: 5.934426
> #1 region with no links:
> #66
> #Link number distribution:
>
> #0 2 3 4 5 6 7 8 9 10 11 12 14
> #1 1 7 19 22 31 21 12 2 2 2 1 1
> #1 least connected region:
> #101 with 2 links
> #1 most connected region:
> #29 with 14 links
>
> nb<- x.nb
> which(card(nb) == 0)
> attr(nb, "region.id")[which(card(nb) == 0)]
>
>
> x.nb2<- edit.nb(x.nb,polys=map)
>
> #> x.nb2<- edit.nb(x.nb,polys=map)
> #Identifying contiguity for deletion ...
> #No contiguity between chosen points
> #Add contiguity? (y/n) y
> #added contiguity between point 53 and 67
> #Options: quit[q] refresh[r] continue[c] c
> #Identifying contiguity for deletion ...
> #No contiguity between chosen points
> #Add contiguity? (y/n) y
> #added contiguity between point 43 and 67
> #Options: quit[q] refresh[r] continue[c] q
>
>
> summary(x.nb2)
>
> #Neighbour list object:
> #Number of regions: 122
> #Number of nonzero links: 726
> #Percentage nonzero weights: 4.877721
> #Average number of links: 5.95082
> #1 region with no links:
> #66
> #Non-symmetric neighbours list
> #Link number distribution:
>
> #0 2 3 4 5 6 7 8 9 10 11 12 14
> #1 1 7 18 22 32 21 12 2 2 2 1 1
> #1 least connected region:
> #101 with 2 links
> #1 most connected region:
> #29 with 14 links
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Dipl.-Ök. Alexander Werner
_______________________________________________
Universität Kassel
Fachbereich Wirtschaftswissenschaften
Fachgebiet Empirische Wirtschaftsforschung
Nora-Platiel-Str. 4
34109 Kassel
Tel.: 0561 / 804 - 3044
werner at wirtschaft.uni-kassel.de
http://cms.uni-kassel.de/unicms/index.php?id=31247
More information about the R-sig-Geo
mailing list