简体   繁体   中英

How can I implement Nearest Neighbor interpolation method in R?

I have rainfall data that I want to interpolate using different interpolation methods. I have used gstat package to calculate IDW and Kriging methods.

But, I am wondering about any R package and related function that I can use to perform the nearest neighbor method in the R environment.

Can any one help please?

You can use gstat package for this, just set nmin and nmax parameters to 1:

idw(formula = Var ~ 1, locations = spatdat, newdata = raster,
        nmax = 1, nmin = 1, force = T, debug.level = -1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM