Function to sum rasters of species layers

sumRastersBySpecies(speciesLayers, layersToSum, filenameToSave, newLayerName)

Arguments

speciesLayers

A RasterStack or RasterLayer that should contain species cover data in the study area

layersToSum

names/indices of layers to be summed - optional

filenameToSave

file path to save output raster

newLayerName

name of the output raster layer