Dear Dr. Bivand and R-users,
 I have a 5 by 5 grid, say, location[1:5,1:5], and I want to know the 
indices of 8 neighbours of each cell. For example, for location[2,2], its 
neighbour coordinates are [1,1:3], [2,1], [2,3] and [3,1:3]. Sometimes I 
also need to remove edge effects (torus = TRUE).
 I have tried "cell2nb" function in your spdep package. Here's my example:
 > neigh <- cell2nb(5,5,type="queen",torus=T)
> neigh
Neighbour list object:
Number of regions: 25 
Number of nonzero links: 200 
Percentage nonzero weights: 32 
Average number of links: 8 
> neigh[1]
[[1]]
[1] 2 5 6 7 10 21 22 25
 Is there way to index each element of neigh[1], i.e., the first is 2, the 
second is 5, ... ? 
 Could you also give me an example of the function "queencell(rowcol, nrow, 
ncol, torus=FALSE, rmin=1, cmin=1)"? What's a rowcol? 
 Thanks,
Xiaohua

-- 
Xiaohua Dai, Dr.
Centre for Systems Research, Durban Institute of Technology
P.O.Box 953, Durban 4000, South Africa

	[[alternative HTML version deleted]]


