powered by
Flip the values of a SpatRaster by inverting the order of the rows (vertical=TRUE) or the columns (vertical=FALSE).
vertical=TRUE
vertical=FALSE
# S4 method for SpatRaster flip(x, vertical=TRUE, filename="", overwrite=FALSE, wopt=list(), ...)
SpatRaster
logical. If TRUE, values are flipped by rows, if FALSE, values are flipped by columns
TRUE
FALSE
character. Output filename. Optional
logical. If TRUE, filename is overwritten
filename
list. Options for writing files as in writeRaster
writeRaster
additional arguments. None implemented
transpose, rotate
transpose
rotate
# NOT RUN { r <- rast(nrow=18, ncol=36) m <- matrix(1:ncell(r), nrow=18) values(r) <- as.vector(t(m)) rx <- flip(r, vertical=FALSE) values(r) <- as.vector(m) ry <- flip(r, vertical=TRUE) # }
Run the code above in your browser using DataLab