[R-sig-Geo] problem with edit.nb

Roger Bivand Roger.Bivand at nhh.no
Thu Aug 26 16:13:07 CEST 2010


On Thu, 26 Aug 2010, Michał Kwieciński wrote:

> Hi all,
>
> I am just about to finish my thesis. The spatial model I want to use
> there is an extension of some work I did back in April. I used R 2.9.2
> then and in order to include 3 additional administrative areas for
> Poland, I edited the shp files (the borders aren't perfectly aligned).
> Then in R I created the nb class object and edited it with edit.nb
> adding three new connections. Everything worked perfect, I had no
> regions with no links and I generated weight matrices with no
> problems.
>
> However, I'd been doing exactly the same thing entire night in R 2.11
> and it did not work (I use the same code I did 4 months ago) and I
> have no idea what is the reason for it. I've been looking for some
> other way to do it, I tried nb2mat and editing the matrix, but I
> surrendered having no idea where and what values I should use.
>
> Before editing nb object R claims that regions 377 and 378 have no
> links. However in edit.nb the 378 and 379 are visible as having no
> links (378 and 379 are cities added on top of bigger shapes, whereas
> 377 was just split from a bigger shape into two smaller ones and only
> the link between these two parts is missing). I connect the circles,
> quit and in the new object there are some new links - the overall
> number has increased - but 377 and 378 are still listed as having no
> links. Editing nb again shows the links, so they have been saved for
> sure.
>
> I am not an advanced R user and most of my code was based on my
> professor's book. However, I think I have spent enough time with
> spatial models and those matrices in order to call this problem really
> weird. Especially since it worked perfectly last time...
>
> I can attach shp files and my code if it will be of any help in order
> to properly investigate this problem. I would really appreciate some
> help, I need to finish the project over the weekend.

Maybe you are using the wrong indices, as FIDs are 0-base but nb objects 
are 1-base. So you may be editing the wrong ones. If this doesn't resolve 
the problem, zip the shapefile and post a link to it, don't attach the 
shapefile, as it would be sent to 1700 people.

Hope this helps,

Roger

>
> Thanks in advance, best regards,
> Michal Kwiecinski
> University of Warsaw student
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

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