I'm new to R and I want to extract the max and min values of a raster and create a new object with them. I need this to be done automatically, not creating the new object by hand as I will iterate the process.
Example. My raster is "elevation":
a <- setMinMax(elevation)
a returns this:
class : RasterLayer dimensions : 2828, 2464, 6968192 (nrow, ncol, ncell) resolution : 90, 90 (x, y) extent : 388323.4, 610083.4, 5261128, 5515648 (xmin, xmax, ymin, ymax) crs : +proj=utm +zone=32 +datum=WGS84 +units=m +no_defs source : dem.tif names : dem values : 92.72564, 1541.76 (min, max)
I want to create two new objects storing the min value (b) and the maximum value (c).