Combine single-layer rasters (RasterLayer objects) into a multi-layer raster (RasterBrick/RasterStack object)

In addition than to create multi-layer rasters from files, the functions stack and brick can also be used to create multi-layer rasters (RasterBrick object) from single layer rasters (RasterLayer objects).


Below an example where two single layers (single layer SPPC rasters for individual year seasons) are combined into a raster brick. Then names are assigned to the individual layers using  the function names from the 'raster' package.

This example is taken from the “Effects of Cyclone Yasi on Green Cover at Mission Beach” tutorial. It can be beneficial to put the code snippets in context by looking at a broader section of the R script. Code snippets have a grey background, and outputs have a white background.