
Last chance! 50% off unlimited learning
Sale ends in
Performs a moving window correlation between two rasters
rasterCorrelation(x, y, s = 3, type = "pearson")
A terra SpatRaster class object
A terra SpatRaster class object for x
A terra SpatRasterclass object for y
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 of output, options are: "pearson", "spearman", "covariance"
Jeffrey S. Evans <jeffrey_evans@tnc.org>
# \donttest{
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)
# }
Run the code above in your browser using DataLab