rasterCorrelation {spatialEco}R Documentation

Raster correlation

Description

Performs a moving window correlation between two rasters

Usage

rasterCorrelation(x, y, s = 3, type = "pearson")

Arguments

x

A terra SpatRaster class object for x

y

A terra SpatRasterclass object for y

s

Scale of window. Can be a single value, two values for uneven window or a custom matrix. Must be odd number (eg., s=3, for 3x3 window or s=c(3,5) for 3 x 5 window)

type

Type of output, options are: "pearson", "spearman", "covariance"

Value

A terra SpatRaster class object

Note

The NA behavior is set to na.rm = TRUE to make default outputs consistent between the terra and raster packages.

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples


library(terra)
 
r <- rast(system.file("ex/logo.tif", package="terra"))  
  x <- r[[1]]
  y <- r[[3]]
  
 r.cor <- rasterCorrelation(x, y, s = 5, type = "spearman")
   plot(r.cor)



[Package spatialEco version 2.0-2 Index]