powered by
Compute quantiles for each cell across the layers of a SpatRaster.
You can also use this method to compute the quantiles of the numeric variables of a SpatVector.
# S4 method for SpatRaster quantile(x, probs=seq(0, 1, 0.25), na.rm=FALSE, filename="", ...) # S4 method for SpatVector quantile(x, probs=seq(0, 1, 0.25), ...)
# S4 method for SpatVector quantile(x, probs=seq(0, 1, 0.25), ...)
SpatRaster or SpatVector
numeric vector of probabilities with values in [0,1]
logical. If TRUE, NA's are removed from x before the quantiles are computed
TRUE
NA
x
character. Output filename
additional arguments for writing files as in writeRaster
writeRaster
SpatRaster with layers representing quantiles
app
# NOT RUN { r <- rast(system.file("ex/logo.tif", package="terra")) r <- c(r/2, r, r*2) q <- quantile(r) q # same but slower # qa <- app(r, quantile) # }
Run the code above in your browser using DataLab