Learn R Programming

raster (version 1.9-19)

flip: Flip

Description

Flip the values of a Raster* object by inverting the order of the rows (direction=y) or the columns direction='x'.

Usage

flip(x, direction, ...)

Arguments

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

Value

  • RasterLayer or RasterBrick

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. "text", "window", or "" (the default, no progress bar) } direction can also be indicated with 1 (=x) or 2 (=y)

See Also

transpose: t, 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 DataLab