Published
Edited
Feb 8, 2022
1 fork
3 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
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
q5 = joinedData.filter((element, index) => {
return element.question == "Q5";
})
Insert cell
q6 = joinedData.filter((element, index) => {
return element.question == "Q6";
})
Insert cell
Insert cell
theme = backGroundData.filter((d) => d.theme == "fragment")
Insert cell
themep = theme.map((d) => {
return { ...d, year5p: d.year5 * 100, year7p: d.year7 * 100 };
})
Insert cell
yearData = {
if (yearGroup == "Year 5") {
return themep.map((d) => {
return {
q: d.q,
answer: d.answer,
distractors: d.distractors,
cohort: d.year5p
};
});
} else {
return themep.map((d) => {
return {
q: d.q,
answer: d.answer,
distractors: d.distractors,
cohort: d.year7p
};
});
}
}
Insert cell
Insert cell
reducer = (previousValue, currentValue) => previousValue + currentValue
Insert cell
itemData = {
if (itemFile) {
return itemFile.csv({ typed: true });
} else {
return [];
}
}
Insert cell
parsedItemData = itemData
.map((d, i) => {
return {
q: i + 1,
class: d["your class"] * 100
};
})
.filter((d) => d.q < 8)
Insert cell
schoolData = {
if (responsesFile) {
return responsesFile.csv({ typed: true });
} else {
return [];
}
}
Insert cell
responsesFile
Insert cell
parsedData = {
return schoolData.map((d) => {
return {
question: d.question,
response: d.response,
class: d.response_pctg
};
});
}
Insert cell
mergeById = (a1, a2) =>
a1.map((itm) => ({
...a2.find(
(item) =>
item.question === itm.question && item.response === itm.response && item
),
...itm
}))
Insert cell
joinedData = mergeById(frequencies, parsedData)
Insert cell
mergeByQ = (a1, a2) =>
a1.map((itm) => ({
...a2.find((item) => item.q === itm.q && item),
...itm
}))
Insert cell
joinedIA = mergeByQ(yearData, parsedItemData)
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more