Learn R Programming

terra (version 1.9-11)

focalValues: Get focal values

Description

Get a matrix in which each row had the focal values of a cell. These are the values of a cell and a rectangular window around it.

Usage

# S4 method for SpatRaster
focalValues(x, w=3, row=1, nrows=nrow(x), fill=NA)

Arguments

Value

matrix

Examples

Run this code
r <- rast(ncol=4, nrow=4, crs="+proj=utm +zone=1 +datum=WGS84")
values(r) <- 1:ncell(r)
focalValues(r)

Run the code above in your browser using DataLab