
Distance to reference values
distValues.RdFor each cell, compute the distance in value-space to reference values. References are a matrix or data.frame whose columns match the layer names of x, or a SpatVector of locations from which values are extracted.
Usage
# S4 method for class 'SpatRaster,matrix'
distValues(x, y, fun="squared", weights=NULL, ...,
filename="", overwrite=FALSE, wopt=list())
# S4 method for class 'SpatRaster,data.frame'
distValues(x, y, fun="squared", weights=NULL, ...,
filename="", overwrite=FALSE, wopt=list())
# S4 method for class 'SpatRaster,SpatVector'
distValues(x, y, fun="squared", center=FALSE, scale=FALSE,
weights=NULL, ..., filename="", overwrite=FALSE, wopt=list())Arguments
- x
SpatRaster
- y
matrix, data.frame, or SpatVector
- fun
character.
"abs"(mean absolute difference),"squared"(mean squared difference) or a function- weights
numeric. Optional weights for the layers of
x- center
logical or numeric. Passed to
scale(SpatVector method only)- scale
logical or numeric. Passed to
scale(SpatVector method only)- ...
additional arguments passed to
fun(for the built-in functions,na.rm=TRUE)- filename
character. Output filename
- overwrite
logical. If
TRUE,filenameis overwritten- wopt
additional arguments for writing files as in
writeRaster