[R] help for cell2nb and queencell in spdep package

From: ecoinfo <ecoinformatics_at_gmail.com>
Date: Thu 04 Aug 2005 - 05:38:12 EST


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

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Aug 04 05:43:30 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:40 EST