Public
Edited
Feb 25, 2023
1 fork
Insert cell
md`# Rock County Map`
Insert cell
d3 = require("d3@5")
Insert cell
topojson = require("topojson-client@3")
Insert cell
rockcounty = FileAttachment("rockcountymap.json").json()
Insert cell
rockcounty_features = topojson.feature(rockcounty, rockcounty.objects.rockcountymap)
Insert cell
csv_data = d3.csvParse(await FileAttachment("rockcountydata.csv").text(),({CensusTract, Pop2010, lalowi1}) => [CensusTract, [+Pop2010, +lalowi1, +lalowi1/+Pop2010]])
Insert cell
CensusTract = Array.from(csv_data.values(), d => d[0])
Insert cell
//this is how to take the values of a variable (column) from all variables you created from the csv file
Pop2010 = Array.from(csv_data.values(), d => d[1][0])
Insert cell
lalowi1 = Array.from(csv_data.values(), d => d[1][1])
Insert cell
Proportion_access = Array.from(csv_data.values(), d => d[1][2])
Insert cell
//this is how you map the id column to the values. We will use this for joining with topojson later.
data = Object.assign(new Map(csv_data), {title: ["Supermarket Accessibility"]})
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