[R-sig-Geo] NAs returned as from and to IDs in gabrielneigh function in the spdep package

Roger Bivand Roger.Bivand at nhh.no
Wed Jan 21 09:39:43 CET 2009


On Tue, 20 Jan 2009, Dan Putler wrote:

> 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"))

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

Roger

>
> Dan
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list