Versions Compared

Key

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


To compute Numerical Summaries for the cells of each layer we can use:

...

Below examples of the computation of numerical summaries for raster layers in R are presented. These examples are taken from the “Effects of Cyclone Yasi on Green Cover at Mission Beach” tutorial. It can be beneficial to put Putting 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., would be benefitial. Boxes with grey background contain code snippets, and boxes with white background containt code (text) outputs.




Multiple numerical summary statistics using the function ‘summary’ from the ‘base’ package

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
#==================================================================================
# Explore SPGC values in both Seasons (Winter 2010 vs Winter 2011)
#==================================================================================

#----------------------------------------------------------------------------------
# Numerical Summary of SPGC Values for both Seasons
#----------------------------------------------------------------------------------

# Summary Statistics (Min, 1st Quartile, Median, 3rd Quartile, Max, and Number of NA's)
summary(SPGC.StudyArea.2010q3_2011q3.rb)

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Mean
cellStats(SPGC.StudyArea.2010q3_2011q3.rb, mean)

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Summary funtions provided in the R installation in combination with the function `values` (from the `raster` package), 
# provide a Summary Statistics for the whole Raster* object. 
 # This works fine for a single layer raster

.

.

RasterLayer object

.

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
mean(values(SPGC.StudyArea.2010q3.rl))

...