[R] Spatial Ananlysis: zero.policy=TRUE doesn't work for no neighbour regions??

Molo kurz_m at uni-hohenheim.de
Tue Apr 16 16:51:10 CEST 2013


Hello,

I'm new to R and to Spatial Analysis and got a problem trying to create a
Spatial Weights Matrix.

*I us the following code to create the Neighbourslist:*

>library(maptools)
>library(spdep)
>library(rgdal)

>location_County<- readShapePoly("....")
>proj4string(location_County)<- CRS("+proj=longlat ellps=WGS84")
>location_nbq<- poly2nb(location_County)
>summary(location_nbq)

*And get this Output:*

Neighbour list object:
Number of regions: 3109 
Number of nonzero links: 18246 
Percentage nonzero weights: 0.1887671 
Average number of links: 5.868768 
4 regions with no links:
35 689 709 881
Link number distribution:

   0    1    2    3    4    5    6    7    8    9   10   11   13   14 
   4   29   40   94  283  616 1045  703  228   51   12    2    1    1 
29 least connected regions:
45 49 587 645 844 853 1206 1286 1391 1416 1456 1478 1485 1545 1546 1548 1558
1612 1621 1663 1672 1675 1760 1794 1795 2924 2925 2952 3107 with 1 link
1 most connected region:
1385 with 14 links

*As there are some regions without neighbours in my data I use the following
code to create the Weights Matrix:*

> W_Matrix<- nb2listw(location_nbq, style="W", zero.policy=TRUE)
>W_Matrix

*And get this Output:*

Fehler in print.listw(list(style = "W", neighbours = list(c(23L, 31L, 42L : 
  regions with no neighbours found, use zero.policy=TRUE

/("Error in print.listw(list(style = "W", neighbours = list(c(23L, 31L, 42L
: 
  regions with no neighbours found, use zero.policy=TRUE")/

As I use "zero.policy=TRUE" I just don't understand what I'm doing wrong...
My question would be: How could I create a Weights Matrix allowing for
no-neighbour areas? 

Thanks
Michael






--
View this message in context: http://r.789695.n4.nabble.com/Spatial-Ananlysis-zero-policy-TRUE-doesn-t-work-for-no-neighbour-regions-tp4664367.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list