Skip to content

Comments

rank#228

Merged
mbostock merged 5 commits intomainfrom
fil/rank
Oct 1, 2021
Merged

rank#228
mbostock merged 5 commits intomainfrom
fil/rank

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").

@Fil Fil added question Further information is requested feature labels Aug 17, 2021
@Fil Fil requested a review from mbostock August 17, 2021 10:33
@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