ra_focal: Function to calculate focal values for a raster object using...

View source: R/ra_focal.R

ra_focalR Documentation

Function to calculate focal values for a raster object using a matrix of weights.

Description

ra_focal has the effect of smoothing a raster object.

Usage

ra_focal(ra, weights, fun = mean, na.rm = FALSE, na.only = FALSE)

Arguments

ra

Raster object.

weights

A 3 by 3 matrix of values for the focal values.

fun

Function to use to sumamrise the focal values

na.rm

Should NAs be ommited from the summaries?

na.only

Should only cells with NAs be replaced with focal values?

Value

Raster object.

Author(s)

Stuart K. Grange

Examples

## Not run: 

ra_focal(
  ra_heights, 
  weights = matrix(1, 3, 3), 
  fun = mean, 
  na.rm = TRUE, 
  na.only = TRUE
)


## End(Not run) 


skgrange/gissr documentation built on Feb. 24, 2024, 2:55 p.m.