I'm using d3.nest.rollup to count leaves in my data. The data comes from csv and is converted to json by d3. The csv looks like this:
Color,ID,Animal
Green,1,Dog
Red,2,Cat
Red,3,Cat
Red,3,Dog
Note that ID #3 has 2 different animals, but I want to count distinct IDs in this data, so each color should return count = 1.
Simple rollup function would return counts of all the leaves, i.e. 1, 1, 2, whereas I need to group by color and count distinct IDs within that group...