Neighbours {bfsMaps} | R Documentation |
Find All Neighbours of a Regional Object
Description
Finding all directly adjacent neighbours of a regional unit is not trivial. For a list of regional units, this function searches for the corresponding Neighbours and returns the results as a list.
Usage
Neighbours(map, id = NULL)
Arguments
map |
the name of the map |
id |
vector of ids for which the Neighbours are to be found. When it's left to |
Value
A list of vectors of ids for the neighbours of each region in the map.
Author(s)
Andri Signorell <andri@signorell.net>
Examples
try( {
nbs <- Neighbours(GetMap("kant.map"), kt_id <- 18)
PlotKant(c(kt_id, nbs), col=c("red", rep("green", length(nbs))) )
# works as well for communities and for vector of ids
nbs <- Neighbours(GetMap("polg.map"), polg_id <- c(3851, 3352))
PlotPolg(c(polg_id, unlist(nbs)),
col=c(rep("red", 2), rep("green", length(unlist(nbs)))))
})
[Package bfsMaps version 1.99.3 Index]