Imagining the rasters would have different min/max,
set.seed(42)
rand_1 <- terra::rast(array(sample(2:9, 100, replace = TRUE), dim=c(10,10,1), dimnames= NULL))
rand_2 <- terra::rast(array(sample(6:11, 100, replace = TRUE), dim=c(10,10,1), dimnames= NULL))
rand_3 <- terra::rast(array(sample(1:7, 100, replace = TRUE), dim=c(10,10,1), dimnames= NULL))
rand_4 <- terra::rast(array(sample(5:10, 100, replace = TRUE), dim=c(10,10,1), dimnames= NULL))
rand_5 <- terra::rast(array(sample(1:20, 100, replace = TRUE), dim=c(10,10,1), dimnames= NULL))
rand_5_diff_min_max <- c(rand_1, rand_2, rand_3, rand_4, rand_5)
rand_5_diff_min_max
class : SpatRaster
dimensions : 10, 10, 5 (nrow, ncol, nlyr)
resolution : 1, 1 (x, y)
extent : 0, 10, 0, 10 (xmin, xmax, ymin, ymax)
coord. ref. :
source(s) : memory
names : lyr.1, lyr.1, lyr.1, lyr.1, lyr.1
min values : 2, 6, 1, 5, 1
max values : 9, 11, 7, 10, 20
where same min/max could be achieved with
rand_5 <- terra::rast(array(sample(2:9, 500, replace = TRUE), dim=c(10,10,5), dimnames= NULL))
If you have dimnames in mind, put them in a dimnames = list('
. Still don't know your thinking on pixels adding to n
.