Description Usage Arguments Details Value Examples
Mimicking rescale
, but more type stable.
1 2 3 4 5 6 7 8 9 10 11 12 |
x |
A vector to manipulate |
to |
An output range |
from |
The input range |
... |
Possible other arguments to downstream functions |
The default method should in theory be type stable as long as
x
can be cast without loss as numeric
and vice versa and has
a type stable range
function. Will throw an error upon lossy casts,
unless wrapped in vctrs::allow_lossy_cast
.
A vector of the same length as x
1 2 3 | # Note that 1:10 returns integers, not doubles
vec_rescale(as.numeric(1:10))
vctrs::allow_lossy_cast(vec_rescale(1:10))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.