View source: R/functions_util.R
rescale_capped | R Documentation |
to
on outputwraps scales::rescale to enforce range of to
on output
rescale_capped(x, to = c(0, 1), from = range(x, na.rm = TRUE, finite = TRUE))
x |
continuous vector of values to manipulate. |
to |
output range (numeric vector of length two) |
from |
input range (vector of length two). If not given, is calculated from the range of x |
x rescaled from from
domain to to
domain, within bounds of to
#behaves identically to scales::rescale when x is within 'from' domain chiptsne:::rescale_capped(0:10, to = c(0, 1), c(0, 10)) scales::rescale(0:10, to = c(0, 1), c(0, 10)) #when x exceeds 'from' domain, results are still within 'to' domain chiptsne:::rescale_capped(0:10, to = c(0,1), c(0,5)) #not true for scales::rescale scales::rescale(0:10, to = c(0,1), c(0,5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.