Public
Edited
Nov 13, 2022
Importers
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
histogram(allTenures[5].withAge, { xProperty: "age", xAxisLabel: 'age', xAxisTicks, quantiles: [.5,.8]}).render()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
getAge = (year) => ({ dateOfBirth }) =>
dateOfBirth === null ? null : (year - (new Date(dateOfBirth).getFullYear()));
Insert cell
Insert cell
Insert cell
groupBy = (...f) => data => d3.group(data, ...f);
Insert cell
groupByState = groupBy(d => d.state)
Insert cell
groupByZone = groupBy(d => stateToZoneMap[d.state], d => d.gender)
Insert cell
groupByState(tenure2019)
Insert cell
Insert cell
Insert cell
not = f => d => !f(d)
Insert cell
Insert cell
tenure2003 = parseTenureData(2003)(tenure2003raw)
Insert cell
tenure2007 = parseTenureData(2007)(tenure2007raw)
Insert cell
tenure2011 = parseTenureData(2011)(tenure2011raw)
Insert cell
tenure2015 = parseTenureData(2015)(tenure2015raw)
Insert cell
tenure2019 = parseTenureData(2019)(tenure2019raw)
Insert cell
hasGender = d => d.gender !== null && d.gender !== "NA"
Insert cell
hasAge = d => d.age !== null
Insert cell
tenure1999raw = FileAttachment("1999-tenure@1.json").json()
Insert cell
tenure2003raw = FileAttachment("2003-tenure@1.json").json()
Insert cell
Insert cell
tenure2011raw = FileAttachment("2011-tenure@1.json").json()
Insert cell
tenure2015raw = FileAttachment("2015-tenure@1.json").json()
Insert cell
tenure2019raw = FileAttachment("2019-tenure@1.json").json()
Insert cell
xAxisTicks = new Array(10).fill(1).map((d,i) => i * 10)
Insert cell
Insert cell
import {histogram} from "@thehogfather/vis-utils"
Insert cell
import { stateToZoneMap } from "@thehogfather/ng-geo-lib"
Insert cell
import { boxY } from '@observablehq/plot-box'
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