Description Usage Arguments Value Note Author(s) Examples
View source: R/doNearestNeighbor.r
Performs nearest neighbor interpolation
1 | doNearestNeighbor(formula, data, newdata, debug.level = 1)
|
formula |
A formula to define the dependent and the independent variables, see the documentation of krige. Note that nearest neighbor does not support independent variables. Therefor, the formula should always have the form dependent~1. |
data |
The input data, should be a spatial object which supports coordinates extracting through coordinates() |
newdata |
A spatial object with the prediction locations. |
debug.level |
standard value set to 1 |
... |
parameters that are passed on to Tps |
The function returns a spatial object with the same class as newdata
with the prediction and the
variance (NA in this case). The names of the columns match the outcome of the krige function.
This functions uses idw with 'nmax' set to 1 to perform nearest neighbor interpolation.
Paul Hiemstra, p.h.hiemstra@gmail.com
1 2 3 4 5 6 7 | library(sp)
data(meuse)
coordinates(meuse) = ~x+y
data(meuse.grid)
gridded(meuse.grid) = ~x+y
meuse_nn = doNearestNeighbor(zinc~1, meuse, meuse.grid)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.