clip | R Documentation |
Clip (i.e., limit) the values in a vector, matrix, or array.
clip(x, .min, .max, ...)
## Default S3 method:
clip(x, .min, .max, ...)
x |
A vector, matrix, or multi-way array. |
.min |
Minimum value. |
.max |
Maximum value. |
... |
Additional optional arguments. |
Returns x
with values outside the interval
[.min
, .max
] clipped to the interval edges. That is, values
in x
smaller than .min
become .min
, and values larger
than .max
become .max
.
clip(1:10, 3, 8) # [1] 3 3 3 4 5 6 7 8 8 8
clip(randn(5, 5), .min = -1, .max = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.