Skip to contents

The grid

A grid is a list of four things: dimension, extent, crs, values. These make one, ask it questions, and hand it to another package.

grid_spec()
A grid, as a plain list
grid_xy()
Coordinates of the cell centres
grid_ncell()
Number of cells in a grid
grid_res()
Cell size in each direction
is_grid()
Is this a guerrilla grid?
as_grid()
Read another package's raster as a grid
as_raster() as_terra() as_gdalraster()
Hand a grid to another package
plot(<guerrilla_grid>)
Plot a grid
as.matrix(<guerrilla_grid>)
Turn a grid into a matrix
as.data.frame(<guerrilla_grid>)
Turn a grid into a data frame

Interpolation

Every one of these takes coordinates, values and a grid, and returns a grid. They differ in what they assume, and the documentation says what.

grid_bin()
Bin values into grid cells
grid_voronoi()
Nearest neighbour interpolation, by Voronoi tessellation
grid_barycentric()
Interpolate to a grid across a triangulation
grid_idw()
Inverse distance weighted interpolation
grid_tps()
Thin plate spline interpolation
grid_kriging()
Kriging
grid_gam()
Generalized additive model on the coordinates
grid_smooth()
Kernel smoothing on a grid
grid_gdal()
Interpolate with GDAL's own gridder
mesh_raster()
Mesh raster

The arithmetic, in the open

The parts other packages keep in C. These exist to be read, and to check that the fast paths compute what they claim to.

bary_weights()
Barycentric coordinates of points within a triangle
find_triangle()
Which triangle is each point in?
grid_facet_lm()
Fit a plane within each Delaunay triangle

Input

xyz_input()
Coordinates and values, from whatever you have
collapse_duplicates()
Collapse coordinates that repeat

Data

bathy
Bathymetry and topography for the BROKE-West region

The package

guerrilla guerrilla-package
guerrilla: Illustrate Various Methods of Interpolation for Irregular Data

Superseded

Kept so old code runs. Each one’s help page says what to use instead and why.

tri_fun()
Interpolation to a regular grid via triangulation
defaultgrid()
Create a target grid for interpolation
facets()
Interpolate by fitting a plane within each tessellation facet