nearestNeighbors | R Documentation |
For a list of 'sites', this function first computes a distance matrix(if not specified), then finds the nearest upstream and downstream neighbors for focal pixels 'x'. Note that 'x' does not necessarily have to be in the list of sites, they can be anywhere in the watershed.
nearestNeighbors(ws, x, distMatrix, sites, selfAdjacency = FALSE)
ws |
A watershed, optional unless 'distMatrix' is missing |
x |
A vector of focal pixels (always required) |
distMatrix |
A site by pixel distance matrix, will be computed if not specified |
sites |
A list of sites for the distance matrix, required if distMatrix is missing |
selfAdjacency |
if TRUE, a site can be downstream of itself |
A list with a downstream and an upstream element. Each element is a matrix, where the first column corresponds to the focal pixels in 'x', and the second column lists the nearest neighbors in 'sites'.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.