Platform
Resources
Pricing
Sign in
Get started
Joe Hoffman's Workspace
Workspace
Fork
Public
By
Joseph Hoffman
Edited
Feb 12
Fork of
My first exercise
4
Insert cell
md
`# JH Assignment 1`
Insert cell
1
Insert cell
1
topojson
=
require
(
"topojson-client@3"
)
Insert cell
1
counties
=
FileAttachment
(
"US_county_1950_conflated_cont_WGS84.json"
)
.
json
(
)
Insert cell
1
counties_features
=
topojson
.
feature
(
counties
,
counties
.
objects
.
US_county_1950_conflated_cont_WGS84
)
Insert cell
1
csv_data
=
d3
.
csvParse
(
await
FileAttachment
(
"nhgis0002_ds84_1950_county.csv"
)
.
text
(
)
,
(
{
GISJOIN
,
B32001
,
B32002
}
)
=>
[
GISJOIN
,
100
*
+
B32002
/
(
+
B32001
+
+
B32002
)
]
)
Insert cell
1
//this is how to take the values of a variable (column) from all variables you created from the csv file
nonwhitepct
=
Array
.
from
(
csv_data
.
values
(
)
,
d
=>
d
[
1
]
)
Insert cell
1
//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
:
[
"GISJOIN"
,
"Non-White Pct"
]
}
)
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.
Try it for free
Learn more
Compare fork
Fork
View
Export
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
d3
Edit
Show 1 comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
topojson
Show 1 comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
counties
Show 1 comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
counties_features
Show 1 comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
csv_data
Show 1 comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
nonwhitepct
Show 1 comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
data
Show 1 comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML