Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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

Note

Inverts raster values using the formula: (((x - max(x)) * -1) + min(x)

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

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)

opar <- par(no.readonly=TRUE)
    par(mfrow=c(1,2))
      plot(r, main="original raster")
      plot(r.inv, main="inverted raster") 
par(opar)

spatialEco

Spatial Analysis and Modelling Utilities

v1.3-6
GPL-3
Authors
Jeffrey S. Evans [aut, cre], Melanie A. Murphy [ctb], Karthik Ram [ctb]
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.