List,
 
I am trying to create a GWT file from a shapefile, and all is fine up to
listw2sn, at which point the region number ids are lost.
Here is the code for reference, maybe someone can tell me where I went
wrong?
 
library(rgdal)
library(spdep)
vec <- readOGR(dsn = ".", layer = layerName)
coords <- coordinates(vec)
dist <- dnearneigh(coords, 0, 200, row_names, FALSE)
dlist <- nbdists(dist, coords, FALSE)
idlist <- lapply(dlist, function(x) 1/x)
weights = nb2listw(dist, dlist, W, FALSE)
sn <-listw2sn(weights)
sn2gwt(sn, outName)
 
This outputs a GWT file with region ids from 1 to (in this case) 127, not
those which are specified above(row_names). I've checked (summary) dist,
dlist, idlist, and weights, and they all contain the right region ids, and
I've checked (printed it out) sn, and it does not: so the only thing I can
think of is that they are being lost at listw2sn.
 
Note: I am running R 2.4.1 through the rpy python bindings in qgis (free
open source gis).
 
Carson Farmer
Spatial Pattern Analysis & Research Lab (SPAR)
Department of Geography, University of Victoria
Victoria, BC, Canada
web: www.geog.uvic.ca/spar
email: [EMAIL PROTECTED]
 

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to