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

Roger Bivand Roger.Bivand at nhh.no
Wed Oct 22 18:19:02 CEST 2003


On Wed, 22 Oct 2003, Luc Anselin wrote:

> Another alternative would be to use the "Tools" in GeoDa
> (free from http://sal.agecon.uiuc.edu/csiss/geoda.html ).
> This creates contiguity and distance based sparse weights
> files (in ascii format) directly from point and polygon shape
> files. The spdep package contains functions to read and
> manipulate these weights files. I'm not familiar with the
> format used by WinBUGS, but I doubt it can be very different.
> L.

>From links from the web page I googled (convert.r AND cgm), and from the 
GeoBUGS manual, their format can be generated, but looks a bit naive as 
is. We could implement it, and/or talk to the GeoBUGS developers about 
using GeoDa (and maybe R/spdep) as a convenient front end - then they 
would avoid having to generate the weights internally. Since they are 
Windows, and WinBUGS is closed source, GeoDa could be a useful 
pre-processing tool (also for spdep weights).

Roger

> 
> 
> On Wednesday, October 22, 2003, at 09:19 AM, Christophe Declercq wrote:
> 
> > Your question is not really clear because:
> >
> > - I don't know what 'convert.r' do
> > - I don't know where 'transf.cgm' is (BTW, 'cgm' is not the usual 
> > extension
> > for shapefiles which is 'shp'). Check if it is really in your current
> > directory.
> >
> > but, yes, if what you want is to import shapefiles in R, it's easy. 
> > Look at
> > the 'maptools' package on CRAN (there is also a 'shapefiles' package).
> >
> > And if you want to build an adjacency matrix for a map of polygons (as 
> > I
> > guess from the header of you mail), look at the 'spdep' package, too. 
> > It is
> > then possible to write a text file with your data as a list readable by
> > WinBUGS.
> >
> > (I send a copy of my answer to the the R-SIG-GEO mailing list which 
> > can be
> > of interest to you).
> >
> > Hope it helps.
> >
> > Christophe
> > --
> > Christophe DECLERCQ, MD
> > Observatoire Régional de la Santé Nord-Pas-de-Calais
> > 13, rue Faidherbe 59046 LILLE Cedex FRANCE
> > Phone +33 3 20 15 49 24
> > Fax   +33 3 20 55 92 30
> > E-mail c.declercq at orsnpdc.org
> >
> >
> >
> >> -----Message d'origine-----
> >> De : r-help-bounces at stat.math.ethz.ch
> >> [mailto:r-help-bounces at stat.math.ethz.ch]De la part de Orlando 
> >> Zacarias
> >> Envoyé : mercredi 22 octobre 2003 11:58
> >> À : r-help at stat.math.ethz.ch
> >> Objet : [R] adjacency matrix
> >>
> >>
> >> Dear R experts,
> >> I am new to the list and R software. I need to convert arcview
> >> file to Winbugs having R has middle package. Got from friends
> >> that it is possible following the steps:
> >> 1. Converting arcview shapefile to "cgm clear text file"
> >> 2. Downloading "convert.r" to into R
> >>     2.1 use source("convert.r")
> >>      2.2 convert("filename_cgm") without the extension.
> >> But that doesn't work, given the following errors:
> >> ----------------------------
> >> R : Copyright 2003, The R Development Core Team
> >> Version 1.8.0  (2003-10-08)
> >> R is free software and comes with ABSOLUTELY NO WARRANTY.
> >> You are welcome to redistribute it under certain conditions.
> >> Type 'license()' or 'licence()' for distribution details.
> >> R is a collaborative project with many contributors.
> >> Type 'contributors()' for more information.
> >> Type 'demo()' for some demos, 'help()' for on-line help, or
> >> 'help.start()' for a HTML browser interface to help.
> >> Type 'q()' to quit R.
> >> [Previously saved workspace restored]
> >>> source("convert.r")
> >>> convert("transf")
> >> Error in file(file, "r") : unable to open connection
> >> In addition: Warning message:
> >> cannot open file `transf.cgm'
> >>>
> >> -----------------------------------
> >> Have i done some mistakes?Or i am missing some files?
> >> Please assist.
> >> Rgs,
> >> Orlando.
> >>
> >>
> >>
> >> 	[[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help at stat.math.ethz.ch mailing list
> >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> >>
> >
> > _______________________________________________
> > R-sig-Geo mailing list
> > R-sig-Geo at stat.math.ethz.ch
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-geo
> >
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-geo
> 

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




More information about the R-sig-Geo mailing list