-
Notifications
You must be signed in to change notification settings - Fork 179
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
Rank and/or quantile transform #483
Comments
Should this be part of d3-array? |
I figured we would build it and see if it’s useful before we decide. One nuance on implementation: if the same value is repeated, then they should have the same rank, and ranks should be skipped. So for example [3, 1, 3, 4, 2, 0] is mapped to [4, 2, 4, 6, 3, 1] (assuming 1-based ranking). Also I think all non-comparable values would need to be replaced with NaN (or undefined?). |
Also if we use d3.sort we will need to fix d3/d3-array#217 such that all undefined values (null, NaN, and undefined) are moved to the end. |
I've added a "same value" test (with a test on I'm not sold on starting at 1. I see the cosmetic appeal, but it makes this slightly more difficult to, for example, use the rank to lookup a value in another array |
I’m not convinced we want 1-based ranking either. That was just my first thought… we can start with 0-based if you like. |
pull-request for d3.rank d3/d3-array#228 |
Added in #570. |
It’d nice to have a map transform that converts quantitative values into ranks (1, 2, 3, …) or the equivalent p-quantile in [0,1]. This would be an alternative to the quantile scale.
The text was updated successfully, but these errors were encountered: