Learn R Programming

spdep (version 0.2-3)

read.gwt2nb: Read and write GeoDa GWT spatial neighbour files

Usage

read.gwt2nb(file, region.id=NULL)
write.sn2gwt(sn, file, shpfile=NULL, ind=NULL)

Arguments

file
name of file with GWT lattice data
region.id
region IDs
sn
a spatial.neighbour object
shpfile
Shapefile name taken from GWT file for this dataset
ind
region id indicator variable name

Value

    References

    Luc Anselin (2003) GeoDa 0.9 User's Guide, pp. 80--81, Spatial Analysis Laboratory, Department of Agricultural and Consumer Economics, University of Illinois, Urbana-Champaign, http://agec221.agecon.uiuc.edu/csiss/pdf/geoda093.pdf

    See Also

    read.gal

    Examples

    Run this code
    data(baltimore)
    STATION <- baltimore$STATION
    gwt1 <- read.gwt2nb(system.file("etc/weights/baltk4.GWT", package="spdep")[1],
     STATION)
    cat(paste("Neighbours list symmetry;", is.symmetric.nb(gwt1, FALSE, TRUE),
     ""))
    listw1 <- nb2listw(gwt1, style="B", glist=attr(gwt1, "GeoDa")$dist)
    tmpGWT <- tempfile()
    write.sn2gwt(listw2sn(listw1), tmpGWT)
    gwt2 <- read.gwt2nb(tmpGWT, STATION)
    cat(paste("Neighbours list symmetry;", is.symmetric.nb(gwt2, FALSE, TRUE),
     ""))
    diffnb(gwt1, gwt2)

    Run the code above in your browser using DataLab