regress | R Documentation |
Run a regression model for each cell of a SpatRaster. The independent variable can either be defined by a vector, or another SpatRaster to make it spatially variable.
## S4 method for signature 'SpatRaster,numeric'
regress(y, x, formula=y~x, na.rm=FALSE, cores=1, filename="", overwrite=FALSE, ...)
## S4 method for signature 'SpatRaster,SpatRaster'
regress(y, x, formula=y~x, na.rm=FALSE, cores=1, filename="", overwrite=FALSE, ...)
y |
SpatRaster |
x |
SpatRaster or numeric (of the same length as |
formula |
regression formula in the general form of |
na.rm |
logical. Remove NA values? |
cores |
positive integer. If |
filename |
character. Output filename |
overwrite |
logical. If |
... |
list with named options for writing files as in |
SpatRaster
s <- rast(system.file("ex/logo.tif", package="terra"))
x <- regress(s, 1:nlyr(s))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.