Public
Edited
Oct 3, 2023
Insert cell
Insert cell
data
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
data = {
const sheetRows =
workbook.sheet(0, {headers: true});

const table = aq
.from(sheetRows);

let mostRecentByEmail = table
.orderby(aq.desc('Date'))
.groupby({
email: d => aq.op.lower(d.Email)
})
.rollup({
date: aq.op.max('Date'),
response_count: aq.op.count()
});

return table
.derive({
lower_email: d => aq.op.lower(d.Email)
})
.join(
mostRecentByEmail,
[['Date', 'lower_email'], ['date', 'email']]
)
.select(aq.not('lower_email', 'date'))

}
Insert cell
Insert cell
Insert cell
respondents = {
const sheetRows = workbook
.sheet(0, {
headers: true,
range: 'A:F'
})

// return aq
// .from(sheetRows)
// .groupby({email: d => aq.op.lower(d['Email'])})
// .count()
// .orderby(aq.desc('count'))

const table = aq
.from(sheetRows)
.select('First Name', 'Last Name', 'Email')

const colNames = table
.columnNames()
.map(d => d.replace(' ', '_')
.toLowerCase())
return table
.rename(aq.names(colNames))
.dedupe({
first_name: d => aq.op.lower(d.first_name),
Last_name: d => aq.op.lower(d.last_name),
email: d => aq.op.lower(d.email),
})
// .orderby('Email')
}
Insert cell
info_responses = workbook.sheet(0, {
headers: true,
range: 'D:M'
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
x: {percent: true},
marks: [
Plot.barX(comm_responses, Plot.stackX({x: comm_responses.columns[1], fillOpacity: 0.3, inset: 0.5})),
Plot.textX(comm_responses, Plot.stackX({x: comm_responses.columns[1], text: comm_responses.columns[1], inset: 0.5})),
Plot.ruleX([0, 1])
]
})
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

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