I never thought about duplicates. I have several identical x and y coordinates 
for different transactions in an office building. That is why there is no line( 
some sort of self neighbour), however not exactly. Thank you very much. 



-----Oorspronkelijk bericht-----
Van: Roger Bivand [mailto:roger.biv...@nhh.no]
Verzonden: di 24-8-2010 17:52
Aan: Sabira el Messlaki
CC: r-sig-geo@stat.math.ethz.ch
Onderwerp: Re: [R-sig-Geo] knn2nb
 
On Tue, 24 Aug 2010, Sabira el Messlaki wrote:

> Dear list members,
>
> I want to plot a neighbours list of class nb. I thought that the plot 
> would show 8 neighbour lines. But this is not the case for my plot. Did 
> I do something wrong?
>
> col.knn2nb<-knn2nb(knearneigh(coords, k=8, longlat=F))
>
> plot(coords, border="grey")
> plot(col.knn2nb, coords, xlim=NULL, ylim=NULL, add=TRUE)

But:

table(card(col.knn2nb))
table(sapply(col.knn2nb, anyDuplicated))
table(sapply(1:length(col.knn2nb), function(i) i %in% col.knn2nb[i]))

show that each has eight unique neighbours, and that there are no 
self-neighbours. So perhaps neighbours in the same direction have lines 
that superimpose?

Roger

>
> Thanks in advance
>
>

-- 
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.biv...@nhh.no



        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to