Public
Edited
Sep 6, 2022
1 star
Insert cell
Insert cell
fg = (data, ...selectors) => {
const I = d3.range(data.length);
return Array.from(
d3.flatGroup(I, ...selectors.map((s) => (i) => data[i][s])),
(d) => [
Object.fromEntries(selectors.map((s, i) => [s, d[i]])),
d[selectors.length]
]
);
}
Insert cell
groups = fg(penguins, "island", "sex", "species")
Insert cell
groups[0]
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