O que cada membro fez:
Stela: 1 (a, b, c) Gustavo de Sá: 1 (d, e) Luis Gustavo: 2(passos 8 e 8.1) Vinicius: 2 (passos 8.2 a 8.5)
passo 1: instalar e rodar pacotes para a análise de dados.
install.packages("seasonal")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("highcharter")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("RColorBrewer")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("sidrar")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("ggplot2")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("scales")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("dynlm")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("gridExtra")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("dlyr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
## Warning: package 'dlyr' is not available for this version of R
##
## A version of this package for your version of R might be available elsewhere,
## see the ideas at
## https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages
install.packages("forecast")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("tidyverse")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("readxl")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("lubridate")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
install.packages("ggthemes")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.2'
## (as 'lib' is unspecified)
library(seasonal)
library(highcharter)
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library(RColorBrewer)
library(sidrar)
library(ggplot2)
library(scales)
library(dynlm)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(gridExtra)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:gridExtra':
##
## combine
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(forecast)
library(tidyverse)
## ── Attaching packages
## ───────────────────────────────────────
## tidyverse 1.3.2 ──
## ✔ tibble 3.1.8 ✔ purrr 0.3.4
## ✔ tidyr 1.2.1 ✔ stringr 1.4.1
## ✔ readr 2.1.2 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ readr::col_factor() masks scales::col_factor()
## ✖ dplyr::combine() masks gridExtra::combine()
## ✖ purrr::discard() masks scales::discard()
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ✖ tibble::view() masks seasonal::view()
library(readxl)
library(lubridate)
##
## Attaching package: 'lubridate'
##
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(ggthemes)
EXERCÍCIO 1 - Neste exercício, vamos praticar o uso do pacote sidrar. Na nossa aula, trabalhamos com os dados de desemprego e inflação (IPCA-15). Neste exercício, você deverá se ocupar dos dados do PIB.
dados = get_sidra(api = '/t/1620/n1/all/v/all/p/all/c11255/90687,90691,90696,90707,93404,93405,93406,93407,93408/d/v583%202')
## All others arguments are desconsidered when 'api' is informed
series = c(90687, 90691, 90694, 90696, 90697, 90707, 93404, 93405, 93406, 93407, 93408)
títulos = c('Agropecuária', 'Indústria', 'Construção', 'Serviços', 'Comércio', 'PIB', 'Despesa Familia', 'Governo','FBKF', 'Importações', 'Exportações')
dados = get_sidra(api='/t/1620/n1/all/v/all/p/all/c11255/90687,90691,90696,90707,93404,93405,93406,93407,93408/d/v583%202') %>%
mutate(Data = as.yearqtr(`Trimestre (Código)`, format='%Y%q'))%>%
rename('Setores'='Setores e subsetores')%>%
select(Data, Setores, Valor)%>%
spread(Setores, Valor)%>%
rename('Governo' = 'Despesa de consumo da administração pública')%>%
rename('Despesas das Famílias' = 'Despesa de consumo das famílias')%>%
rename('Agro' = 'Agropecuária - total')%>%
rename('Exportação' = 'Exportação de bens e serviços')%>%
rename('Importação (-)' = 'Importação de bens e serviços (-)')%>%
rename('Indústria' = 'Indústria - total')%>%
rename('PIB' = 'PIB a preços de mercado')%>%
rename('Serviços' = 'Serviços - total')%>%
rename('FBKF' = 'Formação bruta de capital fixo')%>%
as_tibble()
## All others arguments are desconsidered when 'api' is informed
Agropecuária:
agropecuária = ggplot(data = dados)+
geom_line(mapping= aes(x = Data, y = `Agro`), color = "darkblue", size = 0.8)+
labs(title = 'Agropecuária de 1995 a 2020', x = "Tempo (em anos)", y = "Aropecuária")+
theme_minimal()
agropecuária
Exportação:
exportação = ggplot(data = dados)+
geom_line(mapping= aes(x=Data, y=`Exportação`), color = "darkred", size = 0.8)+
labs(title = 'Exportações de 1995 a 2020', x = "Tempo (em anos)", y = "Exportações")+
theme_minimal()
exportação
Importação:
importação = ggplot(data = dados)+
geom_line(mapping= aes(x=Data, y=`Importação (-)`), color = "darkgrey", size = 0.8)+
labs(title = 'Importações de 1995 a 2020', x = "Tempo (em anos)", y = "Importações")+
theme_minimal()
importação
Indústria:
indústria = ggplot(data = dados)+
geom_line(mapping= aes(x = Data, y = `Indústria`), color = "black", size = 0.8)+
labs(title = 'Indústria de 1995 a 2020', x = "Tempo (em anos)", y = "Indústria")+
theme_minimal()
indústria
PIB a Preços de Mercado:
pib = ggplot(data = dados)+
geom_line(mapping= aes(x = Data, y = `PIB`), color = "purple", size = 0.8)+
labs(title = 'Produto Interno Bruto a preços de mercado de 1995 a 2020', x = "Tempo (em anos)", y = "PIB - preços de mercado")+
theme_minimal()
pib
Serviço:
serviços = ggplot(data = dados)+
geom_line(mapping= aes(x = Data, y = `Serviços`), color = "orange", size = 0.8)+
labs(title = 'Serviços de 1995 a 2020', x = "Tempo (em anos)", y = "Serviços")+
theme_minimal()
serviços
Governo:
governo = ggplot(data = dados)+
geom_line(mapping= aes(x = Data, y = `Governo`), color = "green", size = 0.8)+
labs(title = 'Despesas do Governo de 1995 a 2020', x = "Tempo (em anos)", y = "Despesas do Governo")+
theme_minimal()
governo
Formação Bruta de Capital Fixo:
FBKF = ggplot(data = dados)+
geom_line(mapping = aes(x = Data, y = `FBKF`), color = "darkgreen", size = 0.9)+
labs(title = 'Formação Bruta de Capital Fixo de 1995 a 2020', x = "Tempo (em anos)", y = "Formação Bruta de Capital Fixo")+
theme_minimal()
FBKF
Despesa das Famílias.
despesa_familias = ggplot(data = dados)+
geom_line(mapping= aes(x = Data, y = `Despesas das Famílias`), color = "magenta", size = 0.8)+
labs(title = 'Despesa das Famílias de 1995 a 2020', x = "Tempo (em anos)", y = "Despesas das Famílias")+
theme_minimal()
despesa_familias
passo 5: Arranjar todos os gráficos em um só.
grid.arrange(agropecuária, exportação, importação, indústria, pib, serviços, FBKF, governo, despesa_familias, nrow = 3)
c) Faça um gráfico com a série do PIB: passo 6:
PIB_serie = ggplot(dados)+
geom_line(mapping = aes(x = Data, y = `PIB`), color = "purple", size = 0.7) +
scale_x_continuous (name = " Tempo (em anos)", breaks = seq(1995, 2021,2)) +
scale_y_continuous(name = "PIB em série", breaks = seq(90, 180, 5)) +
theme_minimal()
PIB_serie
e) Calcule a taxa de investimento (Formação Bruta de Capital Fixo
(FBKF)/PIB)) e faça um gráfico usando ggplot. Coloque círculos com
valores no seu gráfico, assim como fizemos com a taxa de desemprego.
passo 7 : calcular e plotar gráfico da taxa de investimento.
dados = mutate(dados, Taxa_de_Investimento = FBKF/PIB)
taxa_investimento <- ggplot(dados, aes(x = Data, y = Taxa_de_Investimento))+
geom_line(color = "darkblue")+
geom_point(size = 6,shape = 21, colour = "black", fill = "white")+
geom_text(aes(label = sprintf("%0.2f", round(`Taxa_de_Investimento`, digits = 2))), size = 2,
hjust = 0.5, vjust = 0.5, color = 'black')+
xlab('Tempo (em anos)') + ylab('Porcentagem da Taxa de Investimento')+
labs(title = 'Taxa de Investimento de 1995 a 2020')+
theme_minimal()
taxa_investimento
EXERCÍCIO 2 - Nesse exercício, vamos usar a mesma base de dados da nossa aula ”Dados econômicos: internet”. Especificamente, vamos trabalhar com os dados de seguro-desemprego. Você já sabe como importar e fazer o gráfico usando ggplot para o Brasil. Aqui,você deverá usar a mesma base de dados para construir gráficos de pedidos de seguro-desemprego para as regiões do Brasil. Cada região deverá ter um gráfico com subplots dos seus estados:
passo 8: Importação de dados de pedidos de Seguro Desemprego:
url = 'http://pdet.mte.gov.br/images/Seguro-Desemprego/Segunda%20Quinzena%20de%20Maio/3-%20S%C3%A9rie%20Hist%C3%B3rica%20do%20Seguro-Desemprego%20-%202000%20a%202020%20-%20mensal.xlsx'
download.file(url, destfile = 'seguro.xlsx', mode='wb')
desemprego = read_excel('seguro.xlsx', sheet="Tabela 1", skip=5) %>%
drop_na()
## New names:
## • `` -> `...1`
dates = parse_date_time(colnames(desemprego[-1]), orders='%Y/%m')
names = desemprego$...1
desemprego = t(desemprego[,-1])
row.names(desemprego) = NULL
colnames(desemprego) = names
desemprego = desemprego %>%
as_tibble() %>%
mutate(DATAS = dates) %>%
mutate(DATAS = as.yearqtr(DATAS, format='%Y%q'))%>%
select(DATAS, everything())
passo 8.1: Região Nordeste
al <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = ALAGOAS),color = "darkred", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(2000, 16000, 4000))+
labs(title = 'AL')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
bh <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = BAHIA), color = "darkred", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(12000, 48000, 8000))+
labs(title = 'BH')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
ce <- ggplot(desemprego)+
geom_line(mapping=aes(x = DATAS, y = CEARA),color = "darkred", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(7000, 35000, 5000))+
labs(title = 'CE')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
ma <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = MARANHAO),color = "darkred", size = 0.5)+
scale_x_continuous(name= 'Tempo (em anos)')+
scale_y_continuous(name= 'Desemprego', breaks = seq(2400, 14000, 2000))+
labs(title = 'MA')+
theme_classic()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
pb <- ggplot(desemprego)+
geom_line(mapping=aes(x=DATAS, y=PARAIBA),color = "darkred", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks=seq(2200, 12000, 2000))+
labs(title = 'PB')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
pe <- ggplot(desemprego)+
geom_line(mapping = aes(x=DATAS, y=PERNAMBUCO),color = "darkred", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(7000, 35000, 5000))+
labs(title = 'PE')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
pi <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = PIAUI), color = "darkred", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(1500, 7200, 1200))+
labs(title = 'PI')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
se <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = SERGIPE),color = "darkred", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(1700, 7500, 1200))+
labs(title = 'SE')+
theme_classic()+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
to <- ggplot(desemprego)+
geom_line(mapping=aes(x = DATAS, y = TOCANTINS), color = "darkred", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(1100, 4500, 600))+
labs(title = 'TO')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
grid.arrange(al, bh, ce, ma, pb, pe, pi, se, to, top = 'Região Nordeste', ncol = 3)
passo 8.2: Região Norte
ac <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = ACRE),color = "purple4", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(300, 2400, 600))+
labs(title = 'AC')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
ap <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = AMAPA),color = "purple4")+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks=seq(400,2800, 500))+
labs(title = 'AP')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
am <- ggplot(desemprego)+
geom_line(mapping = aes( x = DATAS, y = AMAZONAS), color = "purple4", size = 0.5)+
scale_x_continuous(name= 'Tempo (em anos)')+
scale_y_continuous(name= 'Desemprego', breaks=seq(2200, 13200, 2000))+
labs(title = 'AM')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
pa <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = PARA), color = "purple4", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(4600, 22000, 4800))+
labs(title = 'PA')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
ro <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = RONDONIA), color = "purple4", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(1500, 7500, 1000))+
labs(title = 'RO')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
rr <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = RORAIMA), color = "purple4", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(200, 1400, 300))+
labs(title = 'RR')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
grid.arrange(rr, ro, pa, am, ap, ac, top='Região Norte', ncol = 2)
passo 8.3: Região Centro-Oeste
df <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = `DISTRITO FEDERAL`), color = "orange", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(4000, 20000, 3000))+
labs(title = 'DF')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
go <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = GOIAS),color = "orange", , size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(8000, 32000, 6000))+
labs(title = 'GO')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
mgr <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = `MATO GROSSO`), color = "orange", size = 0.5)+
scale_x_continuous(name= 'Tempo (em anos)')+
scale_y_continuous(name= 'Desemprego', breaks = seq(4000, 20000, 2500))+
labs(title = 'MT')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
mgs <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = `MATO GROSSO DO SUL`), color = "orange", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(3000, 14000, 2000))+
labs(title = 'MS')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
grid.arrange(df, go, mgr, mgs, top = 'Região Centro-Oeste', ncol = 2)
passo 8.4: Região Sul
rgs <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = `RIO GRANDE DO SUL`), color = "springgreen2", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(20000, 68000, 9000))+
labs(title = 'RS')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
sc <- ggplot(desemprego)+
geom_line(mapping=aes(x=DATAS, y=`RIO GRANDE DO SUL`),color="springgreen2", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks=seq(10000,58000, 8000))+
labs(title = 'SC')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
pr <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = PARANA), color = "springgreen2", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(18000, 64000, 9000))+
labs(title = 'PR')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
grid.arrange(rgs, sc, pr, top = 'Região Sul', ncol = 2)
passo 8.5: Região Sudeste
es <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = `ESPIRITO SANTO`), color = "lightblue", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(6000, 18000, 3000))+
labs(title = 'ES')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
mg <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = `MINAS GERAIS`), color = "lightblue", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(35000, 104000, 22000))+
labs(title = 'MG')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
rj <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = `RIO DE JANEIRO`), color = "lightblue", size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(22000, 84000, 20000))+
labs(title = 'RJ')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
sp <- ggplot(desemprego)+
geom_line(mapping = aes(x = DATAS, y = `SAO PAULO`), color="lightblue" , size = 0.5)+
scale_x_continuous(name = 'Tempo (em anos)')+
scale_y_continuous(name = 'Desemprego', breaks = seq(99000, 282000, 38000))+
labs(title = 'SP')+
theme_minimal()+
theme(plot.title = element_text(size = 12, hjust = 0.5))+
theme(axis.title.x = element_text(size = 10, hjust = 0.5))+
theme(axis.title.y = element_text(size = 10, hjust = 0.5))
grid.arrange(es, mg, rj, sp, top = 'Região Sudeste', ncol = 2)