Trim (shrink) a Raster* object by removing outer rows and columns that all have the same value (e.g. NA).
Or remove the whitespace before or after a string of characters (or a matrix, or the chracter values in a data.frame).
Usage
## S3 method for class 'Raster':
trim(x, padding=0, values=NA, filename='', ...)
## S3 method for class 'character':
trim(x, ...)
Arguments
x
Raster* object or a character string
values
numeric. Value(s) based on which a Raster* should be trimmed
padding
integer. Number of outer rows/columns to keep
filename
character. Optional output filename
...
If x is a Raster* object: additional arguments as for writeRaster
Value
A RasterLayer or RasterBrick object (if x is a Raster* object) or a character string (if x is a character string).