Skip to content

"dnearineigh" source code

2 messages · Ebrahim Jahanshiri, Roger Bivand

#
On Thu, 8 Sep 2011, Ebrahim Jahanshiri wrote:

            
Please see:

http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf

pp. 43-45 for a general answer. For all CRAN packages, the source code is 
always available for current versions on the package page, and for earlier 
versions in the archives. For some packages, including spdep, R-Forge 
hosting means that the source code can also be browsed online, at:

https://r-forge.r-project.org/scm/viewvc.php/?root=spdep

However, you are almost certainly not approaching this in a sensible way, 
as the glist= argument provides complete flexbility for adding arbitrary 
general weights to an nb object - list of neighbours. You do not need 
access to dnearneigh() internals to do this. If you want to define the 
neighbours in some specific way not already provided, you need to create a 
list of integer vectors of indices in the 1:n range for n observations, 
coding no-neighbour observations with the single integer id 0, adding 
class and other attributes.

Hope this helps,

Roger