-
Notifications
You must be signed in to change notification settings - Fork 22.8k
d3.distinct() / d3.nest.distinct() #472
Copy link
Copy link
Closed
Description
It'd be nice to have a version of d3.nest for computing the number of distinct keys. Currently, you can do something like this:
var m = d3.nest().key(function(d) { return d.foo; }).entries(objects).length;However, it would be faster to just compute the distinct count than to populate all the entries. That might look like this:
var m = d3.nest().key(function(d) { return d.foo; }).distinct(objects);Alternatively, this could be provided as a d3.distinct(array[, f]) method. It's kind of nice that you can get the same functionality out of a nest operator, though. However, it's a bit weird since the nest operator allows multiple keys; do you want the number of distinct values for all keys? Or just the first key? Probably across all keys.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels