The tidy data > JavaScript arrays visual in Mike F's notebook is super helpful. I wonder if we want a separate notebook on data structures and language -- we could make slightly updated (& on brand) visuals? Could be really useful.
Great notebook!
One comment:
I was wondering why the cute little graphics don't match the topic - at least not for the first ones. Just at the end I finally noticed I falsely associated the graphics with the title above the graphics. It took me a while to understand the graphics come first, then comes the title - suddenly all graphics make perfect sense!
Maybe it's just me, you might ask someone else, otherwise you might consider starting each section with the title and then followed by the cute graphics.
The function `d3.rollup` returns a Map, which does not allow for further reference to the elements, by their names. How to deal with that if I want to do some more grouping or other wrangling afterwards?
Good question! You can use d3.flatRollup or d3.rollups instead to return an array. Combined with map (as shown here: https://observablehq.com/@d3/d3-flatgroup#cell-54), this will get your grouped values back into a 2D array that you can continue with.
Sure! You could do something like have one cell like this:
columns = ['a', 'b', 'c', 'd']
And then the map would be:
myData.map(d => ({...columns.map(e => d[e])}) )
You could use checkbox input for the "columns" cell so its interactive. I can make a quick example if this doesnt make sense :)
Thanks! This was helpful. I would love to see a full realistic analysis workflow. For example; Read in a csv file, capture the column names as a variable, filter columns to keep, then select columns to filter by rows (categorical and numeric filtering) with input widgets and all that through variable without any hard coded values. ie; it should work with any random csv file.