clamp | R Documentation |
This function is useful for input validation. If the value of x is in the given range then the function returns x. If the value is outside of the range then the function returns either the max or the min value of the range.
clamp(x, min, max)
x |
numeric. Value to validate |
min |
numeric. Minimum value of range. |
max |
numeric. Maximum value of range. |
The clamped value.
clamp(c(-1, 121, 10, 15), min = 0, max = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.