Learn R Programming

spatialEco (version 0.1-7)

raster.transformation: Statistical transformation for rasters

Description

Transforms raster to a specified stastical transformation

Usage

raster.transformation(x, trans = "norm", smin = 0, smax = 255)

Arguments

x
raster class object
trans
Transformation method: "norm", "rstd", "std", "stretch", "nl", "slog", "sr" (please see notes)
smin
Minimum value for stretch
smax
Maxmum value for stretch

Value

raster class object of transformation

Examples

Run this code
  library(raster)
  r <- raster(nrows=100, ncols=100, xmn=571823, xmx=616763, 
              ymn=4423540, ymx=4453690)
    r[] <- runif(ncell(r), 1000, 2500)

 # Postive values so, can apply any transformation    
for( i in c("norm", "rstd", "std", "stretch", "nl", "slog", "sr")) {
  print( raster.transformation(r, trans = i) ) 
   }

 # Negative values so, can't transform using "nl", "slog" or "sr"
r[] <- runif(ncell(r), -1, 1)
   for( i in c("norm", "rstd", "std", "stretch", "nl", "slog", "sr")) {
  try( print( raster.transformation(r, trans = i) ) ) 
   }

Run the code above in your browser using DataLab