Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


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).

...

This example is taken from the “Effects of Cyclone Yasi on Green Cover at Mission Beach” tutorial. Put the code snippets in context, by looking at a broader section of the R script, would likely be beneficial. Code snippets have a  Boxes with grey background contain code snippets, and outputs have a white backgroundboxes with white background containt code (text) outputs.


Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
#==================================================================================
# Combine both Single-Layer Rasters (RasterLayer objects) into a Multi-Layer
# Raster (RasterBrick object)
#==================================================================================

SPGC.StudyArea.2010q3_2011q3.rb = brick(SPGC.StudyArea.2010q3.rl, SPGC.StudyArea.2011q3.rl)
names(SPGC.StudyArea.2010q3_2011q3.rb) = c("SPGC.SA.2010q3", "SPGC.SA.2011q3")        
SPGC.StudyArea.2010q3_2011q3.rb

...