focalScore: Focal Statistics Scores

View source: R/fun_focal.R

focalScoreR Documentation

Focal Statistics Scores

Description

This function is a wrapper around terra::focal and performs focal statistics in a circle of a specified radius and for three use cases: sum, mean, or fraction cover.

Usage

focalScore(r, radius, type)

Arguments

r

The raster object on which to perform focal statistics

radius

The radius (in m) of the window used for focal statistics

type

The function to perform: either "sum" (sum all values in focal window), "mean" (average all values in focal window), or "cover" (fraction cover of a land class of interest). For "cover", the raster must have values of 1 for the feature of interest, and of 0 for the rest. NAs are not considered in sums and means.

Value

A raster of the same resolution and extent as r, with the focal statistics calculated


ecoservR/ecoserv_tool documentation built on April 5, 2025, 1:49 a.m.