[R-sig-Geo] Producing a conditional adjacency matrix

Rhys Dubin rhy@@dub|n @end|ng |rom @@nt@ox@@c@uk
Mon Sep 30 15:15:58 CEST 2019


Hi all, 

I have a question regarding matrices (produced using poy2nb in spdep). 

I’m trying to produce an adjacency matrix from a GIS Polygon shapefile with about 500 individual polygons (queen or rook — it doesn’t really matter for now), but conditional on the value of the parent polygon. 

For instance, if a polygon had an arbitrary value of 1, I want to return a list of all neighboring polygons that have a value of 2 or 3 (ie. ≠ 1). The same would go for a polygon with a value of 2 (ie. return all neighbors with a value of ≠ 2). 

Is there a solution to this issue built into spdep, do I need to use a different package, or is it possible to accomplish this with a subsetting command?

Thanks!

Rhys




More information about the R-sig-Geo mailing list