spatialEco (version 1.3-2)

raster.mds: Raster multidimensional scaling (MDS)

Description

Multidimensional scaling of raster values within an N x N focal window

An MDS focal function. If only one value provided for s, then a square matrix (window) will be used. If window.median = FALSE then the center value of the matrix is returned and not the median of the matrix

Usage

raster.mds(r, s = 5, window.median = FALSE, ...)

Arguments

r

Raster layer

s

Window size (may be a vector of 1 or 2) of n x n dimension.

window.median

(TRUE/FALSE) Return the median of the MDS matrix values.

...

Additional arguments passed to raster::focal

Value

A raster class object or raster written to disk

References

Quinn, G.P., & M.J. Keough (2002) Experimental design and data analysis for biologists. Cambridge University Press. Ch. 18. Multidimensional scaling and cluster analysis.

Examples

Run this code
# NOT RUN {
 library(raster)
 r <- raster(system.file("external/rlogo.grd", package="raster")) 
   r <- r / cellStats(r, "max")
 
 diss <- raster.mds(r)
 diss.med <- raster.mds(r, window.median = TRUE)

opar <- par(no.readonly=TRUE)
   par(mfrow=c(2,2))
   plot(r)
     title("R logo band-1")
   plot( focal(r, w = matrix(1, nrow=5, ncol=5), fun = var) )
     title("Variance")		 
     plot(diss)
       title("MDS")
     plot(diss.med)
       title("Median MDS")
par(opar)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab