Learn R Programming

spatialEco (version 0.1-7)

raster.invert: Invert raster

Description

Inverts (flip) the values of a raster

Usage

raster.invert(x)

Arguments

x
raster object

Value

raster class object with inverted (flipped) raster values

Examples

Run this code
  library(raster)
  r <- raster(nrows=500, ncols=500, xmn=571823, xmx=616763, 
              ymn=4423540, ymx=4453690)
    r[] <- runif(ncell(r), 1, 100)
 r <- focal(r, focalWeight(r, 150, "Gauss") )
  r.inv <- raster.invert(r)
    par(mfrow=c(1,2))
      plot(r, main="original raster")
      plot(r.inv, main="inverted raster") 
    

Run the code above in your browser using DataLab