Given the SpatRaster r below, how can I interpolate to the point p(x,y) using all the non-NA points located within a certain distance from p? The interpolation method can be either bilinear or average or maximum. But I need to be able to control the interpolation area-of-influence size, either by specifying a radius or a number of grid cells around p.
m <- matrix(1:100, nrow=10, ncol=10)
r <- rast(m)
p <- data.frame(x=20,y=30)
I need something like this
val <- interpolation (m,p,radius=5)