50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

geodiv (version 1.1.0)

pad_edges: Extend edges of a matrix.

Description

Extends edge values of a raster or matrix by a specified number of pixels.

Usage

pad_edges(x, size, val = NULL)

Value

A raster with edges padded size number of pixels on each edge.

Arguments

x

A matrix.

size

Numeric. Number of pixels to add to each side.

val

Numeric. If NULL (default), this extends the edge values out. If not null, this value will be used for the extended cells.

Examples

Run this code
# import raster image
data(normforest)
normforest <- terra::unwrap(normforest)

# crop raster to much smaller area
x <- pad_edges(as.matrix(normforest), 3, val = NA)

Run the code above in your browser using DataLab