Learn R Programming

terra (version 1.6-17)

sort: Sort a SpatRaster

Description

Sort the cell values of a SpatRaster across layers

Usage

# S4 method for SpatRaster
sort(x, decreasing=FALSE, filename="", ...)

Value

SpatRaster

Arguments

x

SpatRaster

decreasing

logical

filename

character. Output filename

...

additional arguments for writing files as in writeRaster

Examples

Run this code
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