r <- rast(nrows=10, ncols=10)
set.seed(2)
values(r) <- sample(5, ncell(r), replace=TRUE)
freq(r)
x <- c(r, r/3)
freq(x, bylayer=FALSE)
freq(x)
freq(x, digits=1)
freq(x, digits=-1)
freq(x, value=5)
Run the code above in your browser using DataLab