Re: [R] GeoDa spdep

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Tue, 01 Apr 2008 10:27:13 +0000 (UTC)

Steve Schachterle <steve.schachterle <at> gmail.com> writes:

>
> My question is in regard to the spdep and GeoDa packages. Do you know how
> to extract a neighborhood/adjacency matrix from R? I need a matrix that has
> all the neighborhoods on the X and Y axis, and then a r=1 when the
> neighborhoods touch, and a r=0 when neighborhoods don't touch. I
> think the Moran's I functions use a matrix like this when they estimate
> Moran's I. I can estimate Moran's I, but I can't figure out how to
> extract the matrix. I've been trying to do this for months and I
> just can't get it.

Look at the help for listw2mat or equivalently nb2mat in spdep - they make square matrices from spatial weight and spatial neighbour list objects respectively. The output matrix will be very sparse.

As far as I know, you can make such matrices by reading GeoDa GAL or GWT files into R, and then convert them to matrices as just described.

Denizens of the GeoDa openspace list, or R's very own R-sig-geo could have helped quickly if you'd asked.

Roger

>
> Thank you so much. The R project is an invaluable gift to the scientific
> and statistical community.
>
> Steve
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 01 Apr 2008 - 10:29:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 01 Apr 2008 - 12:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive