index_summary: Summary Statistics for Spectral Indices

View source: R/summary.R

index_summaryR Documentation

Summary Statistics for Spectral Indices

Description

Computes descriptive statistics for one or multiple spectral index layers in a terra::SpatRaster object, including min, max, mean, median, standard deviation, percentiles (5th, 25th, 75th, 95th), and NA percentage.

Usage

index_summary(x, digits = 4)

Arguments

x

A terra::SpatRaster object containing one or more index layers.

digits

Integer indicating the number of decimal places to round results. Defaults to 4.

Value

A data.frame of class "geo_index_summary" with one row per layer:

index

Layer/index name.

min

Minimum index value.

max

Maximum index value.

mean

Mean index value.

median

Median index value.

sd

Standard deviation.

q05

5th percentile.

q25

25th percentile (1st quartile).

q75

75th percentile (3rd quartile).

q95

95th percentile.

na_pct

Percentage of NA values (0 to 100).

total_cells

Total number of raster cells.

Examples

img <- get_example_data()
ndvi <- geo_index(img, "NDVI")
index_summary(ndvi)

# Multi-layer summary
stack <- geo_indices(img, c("NDVI", "NDWI", "NDBI"))
index_summary(stack)


GeoIndexR documentation built on Oct. 10, 2026, 5:08 p.m.