[R-sig-Geo] problems with dnearneigh of spdep
Stephane DRAY
stephane.dray at umontreal.ca
Fri Oct 29 18:32:56 CEST 2004
Hello,
I have some strange results with the dnearneigh function.
I would like to have all points of grid linked. I do something like that:
> xy=expand.grid(1:10,1:10)
> mydnn=dnearneigh(as.matrix(xy),d1=0,d2=50)
> mydnn
Neighbour list object:
Number of regions: 100
Number of nonzero links: 9896
Percentage nonzero weights: 98.96
Average number of links: 98.96
I assume to have 100*100-100=9900 links.
> m01=nb2mat(mydnn,style="B")
> apply(m01,1,sum)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
19 20 21 22 23 24 25 26 27
98 99 99 99 99 99 99 99 99 98 99 99 99 99 99 99 99 99
99 99 99 99 99 99 99 99 99
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
46 47 48 49 50 51 52 53 54
99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99
99 99 99 99 99 99 99 99 99
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
73 74 75 76 77 78 79 80 81
99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99 99
99 99 99 99 99 99 99 99 99
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
99 99 99 99 99 99 99 99 99 98 99 99 99 99 99 99 99 99 98
It seems that the first and the last points are not linked. I have choose a
value of d2 very high, and the distance between this two points is only
sqrt(162)
Any ideas ?
Thanks
Stéphane DRAY
--------------------------------------------------------------------------------------------------
Département des Sciences Biologiques
Université de Montréal, C.P. 6128, succursale centre-ville
Montréal, Québec H3C 3J7, Canada
Tel : (514) 343-6111 poste 1233 Fax : (514) 343-2293
E-mail : stephane.dray at umontreal.ca
--------------------------------------------------------------------------------------------------
Web http://www.steph280.freesurf.fr/
More information about the R-sig-Geo
mailing list