if (FALSE) {
if (bru_safe_inla()) {
points <-
sp::SpatialPointsDataFrame(
matrix(1:6, 3, 2),
data = data.frame(val = c(NA, NA, NA))
)
input_coord <- expand.grid(x = 0:7, y = 0:7)
input <-
sp::SpatialPixelsDataFrame(
input_coord,
data = data.frame(val = as.vector(input_coord$y))
)
points$val <- bru_fill_missing(input, points, points$val)
print(points)
# To fill in missing values in a grid:
print(input$val[c(3, 30)])
input$val[c(3, 30)] <- NA # Introduce missing values
input$val <- bru_fill_missing(input, input, input$val)
print(input$val[c(3, 30)])
}
}
Run the code above in your browser using DataLab