Public
Edited
Feb 19
Insert cell
Insert cell
fseprd1223231.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
augmented = results.map( d => {
d.choiceOneMonth = d["Preferred Entry Date 1"]?.getMonth();
d.choiceOneWeekday = d["Preferred Entry Date 1"]?.getDay();
d.choiceTwoMonth = d["Preferred Entry Date 2"]?.getMonth();
d.choiceTwoWeekday = d["Preferred Entry Date 2"]?.getDay();
d.choiceThreeMonth = d["Preferred Entry Date 3"]?.getMonth();
d.choiceThreeWeekday = d["Preferred Entry Date 3"]?.getDay();
d.awardedMonth = d["Awarded Entry Date"]?.getMonth();
d.awardedWeekday = d["Awarded Entry Date"]?.getDay();
return d;
} ).filter( d => d["Results Status"] === "Accepted" )
Insert cell
augmented
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
firstChoices = Object.groupBy(results, ( d ) => d["Preferred Division 2"]);

Insert cell
Object.keys(firstChoices).map( d => firstChoices[d].reduce(
( acc, cv ) => {
if ( cv["Results Status"] === "Accepted" ) {
acc.accepted += 1
} else {
acc.rejected += 1
}
acc.pctAccepted = acc.accepted / ( acc.accepted + acc.rejected )
return acc;
},
{ zone: d, accepted: 0, rejected: 0 }
) )
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Object.groupBy( results, d => d[`Preferred Entry Date ${ choiceNum }`] )
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.

Insert cell
days = {
const days = Object.groupBy(results, ( d ) => d[`Preferred Entry Date ${choiceNum}`]);

return Object.keys(daysFirstChoices).map( d => daysFirstChoices[d].reduce(
( acc, cv ) => {
if ( cv["Results Status"] === "Accepted" ) {
acc.accepted += 1
} else {
acc.rejected += 1
}
acc.pctAccepted = acc.accepted / ( acc.accepted + acc.rejected )
return acc;
},
{ date: new Date( Date.parse(d) ), accepted: 0, rejected: 0 }
) )
}
Insert cell
tidyDays = days.flatMap( d => [
{ day: d['date'], outcome: accepted: d['accepted'] },
{ day: d['date'], rejected: d['rejected'] }
] )
Insert cell
Plot.plot({
width: 928,
height: 500,
x: {label: null},
y: {tickFormat: "s", tickSpacing: 50},
color: {scheme: "Spectral", legend: "ramp", width: 340, label: "Age (years)"},
marks: [
Plot.barY(data, {
x: "date",
y: "population",
fill: ""
})
]
})
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