[Spdep-devel] spdep [.nb

Dale dale at piratepress.org
Thu Mar 2 12:31:06 CET 2017


Dear all,

For my own project, I've found it necessary to implement a '[.nb'
function.

I'm dealing with spatial and neighbour data, which is provided unsorted
https://github.com/mm0hgw/contiguity/blob/master/test/pics/layerTag_test_OS2010.png

and in order to more easily match electoral data to the country and it's
sub-regions, I'm using 'sp[i,]' to both sort and subset the spatial
data.
https://github.com/mm0hgw/contiguity/blob/master/test/pics/regionTag_test_UK.Wm.Scotland.2010.png

Where 'nb <- poly2nb(sp)'
With the presence of '[.nb' it is possible to use the same 'i' from
'sp[i,]' to do nb[i] and thus get the result of 'poly2nb(sp[i,])' more
cheaply.

I am fairly certain a '[.nb' function more properly belongs in 'spdep'
with 'subset.nb' than in my project.

https://github.com/mm0hgw/contiguity/blob/v0.1.7/contiguity/R/nb.edit.R
The function '[.nb' is defined from line 36.

It currently has minimal documentation for 'devtools::check()' to
refrain from complaint, and no examples.

Yours
Dale




More information about the Spdep-devel mailing list