Public
Edited
Dec 20, 2022
Insert cell
Insert cell
out = {
const mod_count = {
"exp.gel": 13,
"oth": 5,
"gra": 26,
"mol": 1,
"exp": 5,
"mic": 36,
"mic.ele": 32,
"mic.flu": 122,
"gra.his": 2,
"gra.lin": 6,
"exp.pla": 2,
"rad": 2
}

const modalities = ["exp.gel", "mic"];
const preferredOrder = Object.keys(mod_count).filter(el => modalities.includes(el));
const counts = preferredOrder.map(el => ({"modality": el, "count": mod_count[el]}))
return counts.sort((a,b) => (b.count - a.count))
}
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