sapp: Apply a terra function that takes only a single layer and returns a SpatRaster to all layers of a SpatRaster
Description
Apply to all layers of a SpatRaster a function that only takes a single layer SpatRaster and returns a SpatRaster (these are rare). In most cases you can also use lapply or sapply for this.
Or apply the same method to each sub-dataset (SpatRaster) in a SpatRasterDataset