rg_krige: Kriging of spatial data

Description Usage Arguments Examples

View source: R/kriging.R

Description

Tunction to perform kriging with automatic model selection using the function autoKrige. Can generate continuous raster surfaces of interpolated values.

Usage

1
2
3
4
5
6
7
8
9
rg_krige(
  frml,
  input_data,
  pred_locations,
  raster_out = F,
  dem = NULL,
  verbose = T,
  ...
)

Arguments

frml

formula that defines the dependent variable as a linear model of independent variables; suppose the dependent variable has name 'z', for ordinary and simple kriging use the formula 'z~1'; for simple kriging also define 'beta' (see below); for universal kriging, suppose 'z' is linearly dependent on 'x' and 'y', use the formula 'z~x+y'.

input_data

sp object containing the data to be interpolated

pred_locations

sp object containing the prediction locations. If you want to krige values onto a continuous grid transform a raster to point object using rasterToPoints. See example.

raster_out

logical, indicating if an interpolated raster or a table is desired as output

dem

raster object, a digital elevation model, will be used in the function rasterize to transfer values from pred_locations to raster cells

verbose

logical, should intermediate messages be printed?

...

parameters passed on to autoKrige

Examples

1
2
3
4
5
6
dem <- raster::raster('dem.tif')
st_grd <- raster::rasterToPoints(dem, spatial = T)

data_in <- rgdal::readOGR('points.shp')   #A shapefile containing values to be interpolated in a column called 'resid'

result <- rg_krige(frml = resid ~ 1, input_data = data_in, pred_locations = st_grd, raster_out = T, dem = dem)

sitscholl/Rgadgets documentation built on Feb. 19, 2021, 1:24 a.m.