Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rasterCorrelation

Raster correlation


Description

Performs a simple moving window correlation between two rasters

Usage

rasterCorrelation(x, y, s = 3, type = "pearson", file.name = NULL, ...)

Arguments

x

raster class object for x

y

raster class 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",

file.name

Name of output raster (optional)

...

Additional arguments passed to writeRaster

Value

raster class object or raster written to disk

Note

Depends: raster

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

library(raster)                                                                    
 b <- brick(system.file("external/rlogo.grd", package="raster"))
 x <- b[[1]]
 y <- b[[3]]
 r.cor <- rasterCorrelation(x, y, s = 5, type = "spearman")
 plot(r.cor)

spatialEco

Spatial Analysis and Modelling Utilities

v1.3-6
GPL-3
Authors
Jeffrey S. Evans [aut, cre], Melanie A. Murphy [ctb], Karthik Ram [ctb]
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.