Como ter acesso aos dados do Sidra.
library(ipeadatar)
library(ggplot2)
library(dplyr)
library(geobr)
library(jsonlite)
library(sidrar)
#https://apisidra.ibge.gov.br/values/t/3939/n1/all/v/all/p/all/c79/32794
sui<-get_sidra(api = "/t/3939/n1/all/v/all/p/all/c79/32794")
## All others arguments are desconsidered when 'api' is informed
ggplot(sui, aes(x=Ano, y=Valor)) + geom_point()+geom_line()
## `geom_line()`: Each group consists of only one observation.
## ℹ Do you need to adjust the group aesthetic?
ggplot(sui, aes(x = as.numeric(Ano), y = Valor/1e6)) +
geom_point() +
geom_line() +
labs(title = "Suínos (milhões)",
x = NULL, # Remove a legenda "Ano" do eixo horizontal
y = "Quantidade") +
scale_x_continuous(breaks = seq(min(as.numeric(sui$Ano)), max(as.numeric(sui$Ano)), by = 5)) +
theme_minimal()
sui2<-get_sidra(api = "/t/3939/n6/all/v/all/p/1974,1984,1994,2004,2014,2024/c79/32794")
## All others arguments are desconsidered when 'api' is informed