bound | R Documentation |
This function bounds a number within a specified range. This function is vectorized in a way such that either or both lowerbound and upperbound can be length 1 or the same length as the input vector.
bound(num, lowerbound, upperbound)
num |
A numeric vector to be bounded. |
lowerbound |
The lower bound of the range. |
upperbound |
The upper bound of the range. |
A numeric vector with elements bounded within the specified range.
bound(1, 0, 2)
bound(1:10, -1, 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.