Published
Edited
Mar 21, 2022
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
response
Insert cell
mutable response = []
Insert cell
Insert cell
Insert cell
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
Insert cell
function group(data, by = 'wd', wrap = ['aat', 'parent']) {
return [...new Set(data.map(d => d[by]))].map(d => {
const matches = data.filter(d2 => d === d2[by])
return {
...matches[0],
...Object.fromEntries(wrap.map(w => {
return [w, matches.map(m => m[w]).filter(v => v != null)]
}))
}
})
}
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