Learn R Programming

terra (version 1.0-10)

quantile: SpatRaster local quantiles

Description

Compute quantiles for each cell across the layers of a SpatRaster

Usage

# S4 method for SpatRaster
quantile(x, probs=seq(0, 1, 0.25), na.rm=FALSE,
    filename="", overwrite=FALSE, wopt=list(), ...)

Arguments

x

SpatRaster

probs

numeric vector of probabilities with values in [0,1]

na.rm

logical. If TRUE, NA's are removed from x before the quantiles are computed

filename

character. Output filename. Optional

overwrite

logical. If TRUE, filename is overwritten

wopt

list. Options for writing files as in writeRaster

...

additional arguments, none implemented

Value

SpatRaster with layers representing quantiles

See Also

app

Examples

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