[R-sig-Geo] [R] adjacency matrix

Roger Bivand Roger.Bivand at nhh.no
Thu Nov 15 16:59:35 CET 2007


On Thu, 15 Nov 2007, Yang Aijun wrote:

> Dear R experts:
>
>     The purpose of this e-mail is that I want to ask a question about "How
> to get adjacency matrix from WINBUGS with ARCVIEW(.shp) files".As I can not
> generate the "theme2.txt"  by convert.r .when I run the R project,it show
> the problem as follows:
>> source("convert.s")

You need to be very much more specific in your question. I guess (although 
you have not said so) that you are refering to:

http://www.biostat.umn.edu/~brad/yuecui/index.html

but this is far from common knowledge. When running other people's 
functions (not packages - packages on CRAN are thoroughly checked), you 
have to be careful to do exactly as they did on the same platform. You 
will need to debug() the convert function to see where it derails.

You could try the nb2WB() function in the spdep package instead, and use 
either functions in the maptools or rgdal packages to read in the 
shapefile without the route via CGM text file. Generate the neighbours 
list in spdep by any method you choose (poly2nb is simplest for contiguity 
neighbours for polygon shapes). It also removes the requirement to have a 
running copy of ArcView.

Roger

>> convert("theme2")
> Read 289 records
> Error in if (letter <= "9" & letter >= "0") { :
>        missing value where TRUE/FALSE needed
>
> Would you please give me a help.Thank you!
>
> Best regards
>
> Aijun Yang
>
> The Department of Statistics
> The Chinese University of Hongkong
> N.T. Hongkong
>

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