Published
Edited
Apr 24, 2019
Insert cell
md`# Bio Data Analysis`
Insert cell
z = require('zebras')
Insert cell
d3 = require('d3')
Insert cell
bio_data = d3.csv('https://gist.githubusercontent.com/nofurtherinformation/b64e3eec73c22fc55f13fce898920c76/raw/a7c12420bdfe8aa4cdbe5923078dc6a309bb68b3/bio_data.csv')
Insert cell
z.valueCounts(z.getCol('SUBELEMENT', z.filter(c=>c.ELEMENT == 'INVERT', bio_data)))
Insert cell
z.valueCounts(z.getCol('SUBELEMENT', z.filter(c=>c.ELEMENT == 'FISH', bio_data)))
Insert cell
z.valueCounts(z.getCol('SUBELEMENT', z.filter(c=>c.ELEMENT == 'BIRD', bio_data)))
Insert cell
z.valueCounts(z.getCol('SUBELEMENT', z.filter(c=>c.ELEMENT == 'REPTILE', bio_data)))
Insert cell
bio_data_grouped = {
let grouping = [];
(Object.keys(z.groupBy(x => x.ELEMENT, bio_data))).forEach(function(ELEMENT){
let datum = z.gbSum("Shape_Area", z.groupBy(r=>r.SUBELEMENT, z.groupBy(x => x.ELEMENT, bio_data)[ELEMENT]))
for (let i=0; i<datum.length;++i){
let currRow = {}
currRow.ELEMENT = ELEMENT
currRow.SUBELEMENT = datum[i].group
currRow.AREA = datum[i].sum
currRow.AREA_2 = datum[i].sum * Math.random()
grouping.push(currRow)
}
})
let filtered = z.filter(x=>x.ELEMENT == "FISH" || x.ELEMENT == "BIRD" || x.ELEMENT == "REPTILE" || x.ELEMENT == "INVERT", grouping)
return filtered;
}
Insert cell
md`# Habitat Area`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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