Cap matrix values at specified minimum and/or maximum. Requires matrix to be active.
Examples
mat <- matrix(rnorm(20), nrow = 4, ncol = 5)
tm <- tidymatrix(mat)
# Clip to [-2, 2] range
tm_clipped <- tm |>
activate(matrix) |>
clip_values(min = -2, max = 2)
# Only set floor
tm_floor <- tm |>
activate(matrix) |>
clip_values(min = 0)