Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

bru_fill_missing

Fill in missing values in Spatial grids


Description

Computes nearest-available-value imputation for missing values in space

Usage

bru_fill_missing(
  data,
  where,
  values,
  layer = NULL,
  selector = NULL,
  batch_size = 500
)

Arguments

data

A SpatialPointsDataFrame, SpatialPixelsDataFrame, or a SpatialGridDataFrame containg data to use for filling

where

A, matrix, data.frame, or SpatialPoints or SpatialPointsDataFrame, containing the locations of the evaluated values

values

A vector of values to be filled in where is.na(values) is TRUE

layer, selector

Specifies what data column or columns from which to extract data, see component() for details.

batch_size

Size of nearest-neighbour calculation blocks, to limit the memory and computational complexity.

Value

An infilled vector of values

Examples

## Not run: 
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)

}

## End(Not run)

inlabru

Bayesian Latent Gaussian Modelling using INLA and Extensions

v2.3.1
GPL (>= 2)
Authors
Finn Lindgren [aut, cre, cph] (<https://orcid.org/0000-0002-5833-2011>, Finn Lindgren continued development of the main code), Fabian E. Bachl [aut, cph] (Fabian Bachl wrote the main code), David L. Borchers [ctb, dtc, cph] (David Borchers wrote code for Gorilla data import and sampling, multiplot tool), Daniel Simpson [ctb, cph] (Daniel Simpson wrote the basic LGCP sampling method), Lindesay Scott-Howard [ctb, dtc, cph] (Lindesay Scott-Howard provided MRSea data import code), Seaton Andy [ctb] (Andy Seaton provided testing and bugfixes)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.