pad_edges: Extend edges of a matrix.

Description Usage Arguments Value Examples

View source: R/movingwindow.R

Description

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

Usage

1
pad_edges(x, size, val = NULL)

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.

Value

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

Examples

1
2
3
4
5
6
7
library(raster)

# import raster image
data(normforest)

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

geodiv documentation built on Sept. 5, 2021, 5:26 p.m.