powered by
Sort the cell values of a SpatRaster across layers.
# S4 method for SpatRaster sort(x, decreasing=FALSE, filename="", ...)
SpatRaster
logical
character. Output filename
additional arguments for writing files as in writeRaster
writeRaster
f <- system.file("ex/elev.tif", package="terra") r <- rast(f) r <- c(r, r/2, r*2) sort(r)
Run the code above in your browser using DataLab