Published
Edited
Sep 24, 2019
1 fork
Insert cell
md`The data set that we have chosen is the atomic bombs that has ever been dropped. This data set contains tests as well as bombs used in warfare. This dataset was found on Github and it was created by Thomas Mock. Considering that this dataset contains information that was accurately collected during nuclear testing, `
Insert cell
d3 = require('d3@5')
Insert cell
d3.csv("https://raw.githubusercontent.com/zavenanarsh/tidytuesday/master/data/2019/2019-08-20/nuclear_explosions.csv")
Insert cell
atomicBombs = d3.csv("https://raw.githubusercontent.com/zavenanarsh/tidytuesday/master/data/2019/2019-08-20/nuclear_explosions.csv", function(d) {
return {
date : +d.date_long,
year : +d.year,
id : +d.id_no,
country : d.country,
name : d.name,
type : d.type,
latitude : +d.latitude,
longitude : +d.longitude,
yield : ((+d.yield_lower) + (+d.yield_upper)) /2
};
})
Insert cell
md`1) This finds the maximum and minimum of the yield of he atomic bombs`
Insert cell
maxYield=d3.max(atomicBombs, d => d.yield)
Insert cell
minYield=d3.min(atomicBombs, d => d.yield)
Insert cell
md`3) Average a set of values `
Insert cell
yieldMedian = d3.median(atomicBombs, d => d.yield)
Insert cell
yieldMean = d3.mean(atomicBombs, d => d.yield)
Insert cell
md` Considering that the Median and the Mean are different, the data is skewed. Furthermore, considering that the mean is greater than the median, the data is positively skewed.`
Insert cell
md`6) Histogram `
Insert cell
import {vl} from '@vega/vega-lite-api'
Insert cell
vl.markBar()
.data(atomicBombs)
.encode(
vl.x().fieldQ('year').bin({step:5}),
vl.y().count()
)
.render()
Insert cell
vl.markBar()
.data(atomicBombs)
.encode(
vl.x().fieldQ('year').bin({step:1}),
vl.y().count()
)
.render()
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