Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

d3 data array to summary object (e.g., "SELECT x, count(*) FROM y GROUP BY x")

View gist:3941080
1 2 3 4 5 6 7 8 9 10
// This may not be the most efficient way to do this, but it's pretty clean
 
var yourObject = d3.nest()
.key(function(d) { return d; })
.rollup(function(d) { return d.length; })
.map(yourArray);
 
// e.g.,
// var input = ["this","is","a","test","for","this","method"];
// var output = {"this":2,"is":1,"a":1,"test":1,"for":1,"method":1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.