class_layers: One layer per class

View source: R/landform.R

class_layersR Documentation

One layer per class

Description

Splits the classified raster of a "landform" object into one presence/absence layer per class, named after the classes. This replaces the list of per-class rasters returned by landform <= 0.2.

Usage

class_layers(x, absent = 0)

Arguments

x

An object of class "landform".

absent

Value given to cells not belonging to the class: 0 (default) or NA.

Value

A multi-layer SpatRaster with one layer for each class present in the classification (1 = cell belongs to the class); cells left unclassified are NA in every layer.

Examples

dem <- malta_dtm()
sp <- landform(dem, scale = 9, plot = FALSE)
layers <- class_layers(sp)
names(layers)
terra::plot(layers[["Ridge"]], main = "Ridge")


landform documentation built on Oct. 22, 2026, 5:19 p.m.