Published
Edited
Nov 3, 2019
Importers
Insert cell
md`# Data Wrangling Functions`
Insert cell
function nestDeep(keysArray, rollupFunction) {
var keyedNest = keysArray.reduce(function(nestFunction, key) {
return nestFunction.key(function(d) {
return d[key];
});
}, d3collection.nest());
return rollupFunction
? keyedNest.rollup(rollupFunction).object
: keyedNest.object;
}
Insert cell
function getFirstArrayVal(array) {
return array instanceof Array && array.length === 1 ? array[0] : 'error';
}
Insert cell
d3collection = require('d3-collection@latest')
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more