Skip to content
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 #228

Merged
merged 5 commits into from
Oct 1, 2021
Merged

rank #228

merged 5 commits into from
Oct 1, 2021

Conversation

Fil
Copy link
Member

@Fil Fil commented Aug 17, 2021

Question: I'm not sure about the API; in particular if we have the idea that the accessor could at some point be specified as a string (like we do in Plot), this would be ambiguous when calling rank(array, "high").

@mbostock
Copy link
Member

I think we should drop the ties argument and only implement the “low” strategy for now.

This should support a comparator as well as an accessor like d3.sort and d3.bisector do, probably using compareDefined to protect against non-comparable values. (I suppose this means that d3.rank should accept multiple accessors like d3.sort does, too… but we didn’t extend that to d3.bisector or for that matter d3.quickselect, so maybe let’s punt on that convenience for now and focus on the basics.)

@Fil
Copy link
Member Author

Fil commented Aug 17, 2021

I've updated https://observablehq.com/@d3/rank-dev and I think it covers everything (rank, ties, comparator, multiple accessors). Just need to decide on the scope and I'll merge the relevant code and tests.

@mbostock
Copy link
Member

mbostock commented Oct 1, 2021

Would you be okay only supporting the ties = low strategy to start? I would prefer to start there and not support the other strategies.

@Fil Fil marked this pull request as ready for review October 1, 2021 12:44
Fil and others added 3 commits October 1, 2021 08:03
* only implement “low” ties strategy
* only test “low” ties strategy
* only allow iterables
* adopt Float64Array.of
* documentation: remove ties; observablehq/@d3/rank
Co-authored-by: Philippe Rivière <fil@rezo.net>
@mbostock mbostock merged commit 2fecbd1 into main Oct 1, 2021
@mbostock mbostock deleted the fil/rank branch October 1, 2021 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

Successfully merging this pull request may close these issues.

2 participants