-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
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
Rescale formula/calculation #395
Comments
print(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: 0x000002261aa1f620>
#> <environment: namespace:scales> Created on 2023-08-22 with reprex v2.0.2 Or by default Where |
Awesome, thank you for the quick response :) |
What is x in x - min(x)? Also, can you please provide some additional guidance as to how I should apply the range ( I think I got it so let's if the rescale range is from 1-100 then the calculation for row value in the column will look like:
But then now that I think about it the start and end value should be different for each row right? like based on the above example would the next row value calculated as follows?
|
Closing this. The input arguments are well documented in the code and further questions should be asked at e.g. https://community.rstudio.com/ as the issue tracker is mainly to track bugs and feature requests |
I would like to know the formula used in rescale. The purpose is to implement the same calculation in MS-Excel.
Thank you
The text was updated successfully, but these errors were encountered: