doNearestNeighbor: Performs nearest neighbor interpolation

Description Usage Arguments Value Note Author(s) Examples

View source: R/doNearestNeighbor.r

Description

Performs nearest neighbor interpolation

Usage

1
doNearestNeighbor(formula, data, newdata, debug.level = 1)

Arguments

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

Value

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.

Note

This functions uses idw with 'nmax' set to 1 to perform nearest neighbor interpolation.

Author(s)

Paul Hiemstra, p.h.hiemstra@gmail.com

Examples

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)

MariekeDirk/GeoInterpolation documentation built on May 14, 2019, 8:20 a.m.