[R-sig-Geo] How to check a large neighbourhood matrix?

Danlin Yu yud at mail.montclair.edu
Thu Mar 27 17:43:17 CET 2008


Oscar:

If you produced the nb list in R, you can always summarize the nb list 
to see whether there are units that don't have neighbors.

For instance:
#loading spdep
library(spdep)

#you have read a shapefile of postal code areas:

post<-read.shape("../yourshapefile.shp")

#since it is a polygon shapefile, a Map2poly and poly2nb function shall 
do the trick (Roger will have better ideas than my naive ones)

post.nb<-poly2nb(Map2poly(post))

#then you summarize the nb list:

summary(post.nb)

The summary command will give you the characteristics of the neighbor 
list object, including Number of regions, Number of nonzero links, 
Percentage nonzero weights, Average number of links, regions that have 
no links (which shall give you the idea whether or not some postal code 
areas are connected) and the most and least connected regions

Hope this helps.

Regards,
Dr. Danlin Yu

Oscar Breugelmans wrote:
> Dear all,
>
> I am working on a neighbourhood matrix of the postal code areas in the
> Netherlands. Reading the shapefile and producing the matrix is no problem
> (after some help from Roger), but I am not completely confident that all
> neighbours are recognized because there are a few polygon boundaries that
> are topologically unclean. I have checked the shapefile as closely as
> possible, but with 4000 postal code areas this is a hell of a job.
> Plotting the matrix in R (using plot.nb) is also not an option because with
> so many areas the individual connections are no longer visible. Thus, I
> would like to zoom in on parts of the graph to check whether all neighbours
> are defined correctly. I searched the web for methods to zoom in and out of
> a graph in R, but couldn't find anything.
> Does anyone know if there are ways to do this?
>
> Oscar
> ____________________________________________________________________________
>
> DISCLAIMER:  http://www.rivm.nl/disclaimer.htm\ ...{{dropped:2}}
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   

-- 
___________________________________________
Danlin Yu, Ph.D.
Assistant Professor
Department of Earth & Environmental Studies
Montclair State University
Montclair, NJ, 07043
Tel: 973-655-4313
Fax: 973-655-4072
email: yud at mail.montclair.edu
webpage: csam.montclair.edu/~yu




More information about the R-sig-Geo mailing list