library(terra)
rast1 <- rast(ncol=10, nrow=10)
values(rast1) <- rep(0:3, 50)
rast2 <- rast(ncol=10, nrow=10)
values(rast2) <- c(rep(0, 50), rep(1,25), rep(2,25))
rast3 <- rast(ncol=10, nrow=10)
values(rast3) <- rep(c(1,3,2,1), 25)
distBrick <- c(rast1, rast2, rast3)
names(distBrick) <- c(0:2)
transectPlot(distBrick, depthLim = 3)
Run the code above in your browser using DataLab