2
I’m trying to create a boxplot of the amount of respirators per state, but when I plot the R counts the frequency of respirators not the amount per state. There I have the following information:
I need the amounts to be summed up, not that he uses the frequency. How can I do this?
Download from the database: https://dados.gov.br/dataset/distribuicao-de-respiradores
Follows script:
distribuicao_respiradores <- read.csv2("~/distribuicao_respiradores.csv", encoding="UTF-8", stringsAsFactors=FALSE)
View(distribuicao_respiradores)
attach(distribuicao_respiradores)
library(ggplot2)
boxplotgraf <- ggplot(distribuicao_respiradores, aes(x=DESTINO, y=QUANTIDADE))
boxplotgraf + geom_boxplot(outlier.color = "red") +
theme_classic() +
labs(y="Quantidade") +
coord_flip()
There is no error in your code, these boxplots are of the quantities. If what you want is only the total per State, boxplots are not for that.
– Carlos Eduardo Lagosta
It’s like @Carloseduardolalike commented. Boxplots, are to see the distribution, with medians , quartiles and etcs. I think you want a histogram.
– Marcos Marques