The function generates a list of neighbours for a grid of cells. Helper functions are used to convert to and from the vector indices for row and column grid positions, and rook (shared edge) or queen (shared edge or vertex) neighbour definitions are applied by type. If torus is TRUE, the grid is mapped onto a torus, removing edge effects.

1 2 3 4 5 |

`nrow` |
number of rows in the grid |

`ncol` |
number of columns in the grid |

`type` |
rook or queen |

`torus` |
map grid onto torus |

`rowcol` |
matrix with two columns of row, column indices |

`i` |
vector of vector indices corresponding to rowcol |

`rmin` |
lowest row index |

`cmin` |
lowset column index |

The function returns an object of class `nb`

with a list of integer vectors containing neighbour region number ids. See `card`

for details of “nb” objects.

Roger Bivand Roger.Bivand@nhh.no

1 2 3 4 5 6 7 |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.