Skip to content

NAs returned as from and to IDs in gabrielneigh function in the spdep package

3 messages · Dan Putler, Roger Bivand

#
Hi,

The issue is as in the subject. I'm running R 2.8.1 with spdep 0.4-29,
tripack 1.2-11, sp 0.9-14, maptools 0.6-13, spam 0.15-2, and Matrix
0.999375-17 under Linux (I'm still on Ubuntu Dapper). In addition to
gabrielneigh returning NAs for "from" and "to" point IDs, when the
resulting graph object is given to graph2nb, R senses a segmentation
fault and experiences a hard crash. The short (self-contained) script
below generates the error on my system.

dx <- rep(0.25*0:4,5)
dy <- c(rep(0,5),rep(0.25,5),rep(0.5,5), rep(0.75,5),rep(1,5))
exampDat <- data.frame(x=c(dx, dx, 3+dx, 3+dx), y=c(dy, 3+dy, dy, 3+dy))
plot(exampDat)
library(spdep)
exampGG <- gabrielneigh(as.matrix(exampDat))
print(data.frame(from=exampGG$from, to=exampGG$to))
# Uncomment the line below to induce a segmentation fault R crash
# exampNB <- graph2nb(exampGG)
rm(list=c("bx","by","exampDat","exampGG","exampNB"))

Dan
#
On Tue, 20 Jan 2009, Dan Putler wrote:

            
Thanks for a clear report with a reproducable example. A revision will be 
forthcoming soon, at least to block the segmentation fault.

Roger

  
    
#
On Wed, 21 Jan 2009, Roger Bivand wrote:

            
0.4-34 submitted to CRAN, fixed this problem (too short vectors passed to 
compiled code being overrun - test now in place to force user to increase 
a multiplier factor manually). In addition, changes to GMerrorsar() and to 
the "SMA" variant of spautolm(), and other recently spotted bugs and/or 
infelicities.

Roger