Tests if one location (actually, the closest node to it) is reachable from the set of nodes of a gData object.
Arguments
- x
a gData object.
- loc
location, specified as a list of two components giving respectively the longitude and the latitude. Alternatively, it can be a matrix-like object with one row and two columns.
Value
a named boolean vector, with one element per node of the input gData object, and names corresponding to node names.
See also
Other connectivity_functions:
areConnected(),
areNeighbours(),
isConnected,gData-method
Examples
# Select African populations Mandenka, Yoruba, and San
hgdp.sub <- hgdp[getData(hgdp)$Population %in%
c("Mandenka", "Yoruba", "San")]
# Get a location that is reachable
location <- getCoords(hgdp[getData(hgdp)$Population == "BantuKenya"])
# Check these are reachable
isReachable(x = hgdp.sub, loc = location)
#> 6433 15411 13518
#> TRUE TRUE TRUE
