zshift: Offset Raster or Matrix Values

Description Usage Arguments Value Examples

View source: R/zshift.R

Description

Calculates a matrix of values with a negative or positive, x or y, offset.

Usage

1
zshift(r, xdist = 0, ydist = 0, xrm, yrm, scale = FALSE)

Arguments

r

A raster or matrix.

xdist

Numeric indicating the number and direction (+, -) of columns for the offset.

ydist

Numeric indicating the number and direction (+, -) of rows for the offset.

xrm

Numeric value or vector indicating the number of columns to be removed from the final matrix. If not set, this value defaults to xdist. Positive values remove columns from the right, while negative values remove columns from the left. The absolute value of xrm must be >= abs(xdist).

yrm

Numeric value or vector indicating the number of rows to be removed from the final matrix. If not set, this value defaults to ydist. Positive values remove rows from the bottom, while negative values remove rows from the top. The absolute value must be >= abs(ydist).

scale

Logical. Indicates whether or not to scale the values of the raster.

Value

A numeric vector of values created from a matrix of the values with the specified offset. The vector is created from a matrix with xrm fewer columns and yrm fewer rows than the original raster value matrix.

Examples

1
2
3
4
5
# import raster image
data(normforest)

# remove right and bottom borders 2 deep
noborder <- zshift(normforest, xdist = 2, ydist = 2)

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