raster (version 1.1.7)

flip: Flip

Description

Flip a RasterLayer by inverting the order of the rows (direction=y) or the columns direction='x'.

Usage

flip(x, direction, ...)

Arguments

x
a RasterLayer object
direction
Character. 'y' or 'x'
...
Additional arguments, see Details

Value

  • a RasterLayer

Details

The following additional arguments can be passed, to replace default values for this function lll{ filename Character. Output filename format Character. Output file type. See writeRaster datatype Character. Output data type. See dataType overwrite Logical. If TRUE, "filename" will be overwritten if it exists progress Character. Valid values are "text", "tcltk", "windows" (on that platform only) and "" } direction can also be indicated with 1 (=x) or 2 (=y)

See Also

rotate

Examples

Run this code
r <- raster(nrow=18, ncol=36)
m <- matrix(1:ncell(r), nrow=18)
r[] <- as.vector(t(m))
rx <- flip(r, direction='x')
r[] <- as.vector(m)
ry <- flip(r, direction='y')

Run the code above in your browser using DataCamp Workspace