Public
Edited
Oct 9, 2022
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
// reads in everything as strings, no problem with that
dataStandard = FileAttachment("dataStandard.csv").csv()
Insert cell
dataStandard.map(d => d.manual)
Insert cell
Insert cell
dataTyped = FileAttachment("dataStandard.csv").csv({typed: true})
Insert cell
dataTyped.map(d => d.manual)
Insert cell
Insert cell
dataD3Auto = d3.csvParse(
await FileAttachment("dataStandard.csv").text(),
d3.autoType
)
Insert cell
dataD3Auto.map(d => d.manual)
Insert cell
Insert cell
Insert cell
dataRSide = FileAttachment("dataRSide.csv").csv({typed: true})
Insert cell
// read in as booleans!
dataRSide.map(d => d.manual)
Insert cell
Insert cell
// loop through and convert columns
dataJSSide = dataTyped.map(d => {
d = {...d};
for (const key of Object.keys(d)) {
if (d[key] === "TRUE") d[key] = true;
if (d[key] === "FALSE") d[key] = false;
}
return d;
})
Insert cell
dataJSSide.map(d => d.manual)
Insert cell
Insert cell
Insert cell
dataTyped.map((d) => {
d = { ...d };
for (let [key, value] of Object.entries(d)) {
if (["FALSE", "TRUE"].includes((value = value + "").toUpperCase())) {
d[key] = JSON.parse(value.toLowerCase());
}
}
return d;
})
Insert cell
Insert cell
Insert cell
Insert cell
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