Compute quantiles for the cell values of a RasterLayer. If you want to compute quantiles for each cell across a number of layers, you can use calc(x, fun=quantile).

quantile(x, ...)

Arguments

x

Raster object

...

Additional arguments: na.rm=TRUE, ncells=NULL, and additional arguments to the stats::quantile function, see quantile

ncells can be used to set the number of cells to be sampled, for very large raster datasets.

Value

A vector of quantiles

See also

Examples

r <- raster(ncol=100, nrow=100)
values(r) <- rnorm(ncell(r), 0, 50)
quantile(r)
#>           0%          25%          50%          75%         100% 
#> -190.7832892  -33.8396457    0.6744588   34.3378072  168.8406643 
quantile(r, probs = c(0.25, 0.75), type=7,names = FALSE)
#> [1] -33.83965  34.33781