[R-sig-Geo] How to list neighbors IDs and corresponding frequencies

Takatsugu Kobayashi tkobayas at indiana.edu
Fri Feb 23 21:09:58 CET 2007


Rusers:

I am trying to compute a Moran's I coefficient for census tracts for 
Indianapolis in R. I have a shapefile for Indianapolis and uploaded it 
into R. I understand how to compute a Moran's I coefficient using knn2nb 
command. How can I compute a Moran's I based on a edge/border contiguity 
matrix?

Also, in Matlab, using the find command, I can find the IDs for 
observations that satisfy some conditions like

a=randn(10,1) % create a row vector that contains 10 random normal numbers
INDEX=find(a>0) % INDEX is a row vector that contains IDs of 
observations whose values are greater than 0
a(INDEX) % Returns frequencies attached to the IDs of observations whose 
values are greater than 0

This way, I can identify nearest neighbors of a point within n miles.

Thank you very much

Takatsugu
Indiana Univ.




More information about the R-sig-Geo mailing list