We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
Is it the intended behaviour that the rescale function does the following? rescale(c(0,0,0,0), to = c(0,100)) [1] 50 50 50 50
rescale(c(0,0,0,0), to = c(0,100))
Wouldn't it be more logical to still have a zero stay zero?
The text was updated successfully, but these errors were encountered:
It seems very much by design that if from has no/zero range, the result has mean(to) as value.
from
mean(to)
scales:::rescale.numeric #> function (x, to = c(0, 1), from = range(x, na.rm = TRUE, finite = TRUE), #> ...) #> { #> if (zero_range(from) || zero_range(to)) { #> return(ifelse(is.na(x), NA, mean(to))) #> } #> (x - from[1])/diff(from) * diff(to) + to[1] #> } #> <bytecode: 0x000001d3024e1bc0> #> <environment: namespace:scales>
Created on 2023-10-24 with reprex v2.0.2
Sorry, something went wrong.
No branches or pull requests
Hi,
Is it the intended behaviour that the rescale function does the following?
rescale(c(0,0,0,0), to = c(0,100))
[1] 50 50 50 50
Wouldn't it be more logical to still have a zero stay zero?
The text was updated successfully, but these errors were encountered: