View source: R/rasterCorrelation.R
rasterCorrelation | R Documentation |
Performs a moving window correlation between two rasters
rasterCorrelation(x, y, s = 3, type = "pearson")
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" |
A terra SpatRaster class object
The NA behavior is set to na.rm = TRUE to make default outputs consistent between the terra and raster packages.
Jeffrey S. Evans <jeffrey_evans@tnc.org>
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.