I'm stuck with a R case study. I need to plot a graph using specific values in my dataset. I have trouble finding the right code. How should I write it?
The dataset is:
data <- read.csv(file = "https://raw.githubusercontent.com/ScPoEcon/ScPoEconometrics/master/inst/datasets/airline-safety.csv")
The question is:
Propose a vizualization showing the evolution of the number of fatal accidents between the two periods
I want to plot a bar plot with my two periods of time in x axis, number of accidents in y axis.
Here is how far I managed to code:
graph_1 <- summarise(group_by(data, type, period), sum_1 =sum(value) )
ggplot((data = graph_1),
aes(x=period, y=type))
geom_bar()
It outputs a graph with: the two periods on the x axis accidents type on the y axis
However, it doesn't use the number of accidents per accident type.
I would expect to have:
- x axis: period 1985_1999,
- y axis: N° of accidents with a bar of 122 for fatal accidents.
Thank you for helping me!

geom_bar(stat="identity")?geom_col()is for, just to make it a bit easier.geom_bar(stat="identity")andgeom_col(). The plot is similar to the initial situation. Thank you very much to both of you for helping me!