calculate_statistics: Calculate statistics for a given raster.

View source: R/stats.R

calculate_statisticsR Documentation

Calculate statistics for a given raster.

Description

Method used to calculate the statistics of all layers. It can be re-used to calculate statistics for a cropped version of the rasters.

Usage

calculate_statistics(layercode, raster)

Arguments

layercode

character. Name of the layer.

raster

RasterLayer. The raster you want to calculate statistics for.

Value

A dataframe with the layercode and all basic statistics.

See Also

layer_stats

Examples

## Not run: 
# calculate statistics of the SST and salinity in the Baltic Sea

# warning using tempdir() implies that data will be downloaded again in the 
# next R session
x <- load_layers(c("BO_sstmax", "BO_salinity"), datadir = tempdir())
e <- extent(13, 31, 52, 66)
baltics <- crop(x, e)
View(rbind(calculate_statistics("SST Baltic Sea", raster(x, layer = 1)))
           calculate_statistics("Salinity Baltic Sea", raster(x, layer = 2)))

## End(Not run)

sdmpredictors documentation built on Aug. 23, 2023, 5:07 p.m.