| clamp | R Documentation |
Restricts x to the interval [min_val, max_val].
Values outside the range are replaced by the nearest bound.
clamp(x, min_val, max_val, warn = TRUE, param_name = "value")
x |
Numeric value or vector |
min_val |
Lower bound |
max_val |
Upper bound |
warn |
Logical; issue a warning when clamping occurs, default TRUE |
param_name |
Name used in warning messages |
x with values outside [min_val, max_val] replaced by the bounds
suppressWarnings(clamp(1.5, 0, 1))
suppressWarnings(clamp(-0.5, 0, 1))
clamp(0.3, 0, 1)
suppressWarnings(clamp(c(-1, 0.5, 2), 0, 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.