Produzido por:
Juliana Angelo
Kayo Fernando
Mateus Elias
Municípios que estão presentes no Consórcio
Foi criado um arquivo em excel (ConsorciosMT.xlsx) que tem os 141 municípios de Mato Grosso, seus respectivos consórcios de desenvolvimento econômico,latitude e longitude.Para poder facilitar na produção de mapas interativos,gráficos e tabelas que será produzido no dashboard dinâmico.
VAB1 - Agropecuária
VAB - Indústria
VAB - Serviços
1 VAB : Valor adicionado Bruto
Tópico 2 - Tabela 5938 - Sidra IBGE
Tópico 3 - Para Produção Agrária iremos utilizar a Tabela 5457 - Sidra IBGE(PAM) e para Pecuária duas tabelas:
Tópico 4 - Para Quantidade de Meis por gênero iremos utilizar o Portal do empreendedor e para a série histórica dos Meis iremos utilizar Simples Nacional.
Tópico 5 - Microdados RAIS/CAGED
Para baixar os dados do RAIS/CAGED é necessário ter o programa FileZilla.
Tópico 6 - EstimaPOP/Tabela 6579 - Sidra IBGE
Tópico 7 - Atlas Brasil
Fazer a consulta pela tabela
knitr::include_graphics("panorama2.png")
## Instale o pacote flexdashboard
##install.packages("flexdashboard")
knitr::include_graphics("panorama1.png") ## pacote knitr para carregar imagens
## Acesse file → New File → Rmarkdown
knitr::include_graphics("panorama3.png")
## Em From Template escolha a opção Flex Dashboard
knitr::include_graphics("panorama4.png")
## Template do Flex Dashboard no Rstudio
knitr::include_graphics("panorama5.png")
## Vamos salvar o Arquivo com um nome, por exemplo "testedashboard"
## aperte o botão Knit para rodar o arquivo em html
knitr::include_graphics("panorama6.png")
## saída do programa em HTML
Cabeçalho
title: “Panorama MT” (Nomenclatura do nosso Dashboard)
output:
flexdashboard::flex_dashboard:
navbar:
orientation: columns
vertical_layout: fill
runtime: shiny (Para deixar o nosso dashboard interativo)
Vamos Carregar agora os pacotes necessários para rodar o nosso dashboard
library(flexdashboard) # template do nosso dashboard
library(plotly) # gráficos interativos
library(rmarkdown)
library(readxl) #leitura de arquivos em excel
library(knitr) # leitura de imagens
library(ggthemes) # temas para gráficos ggplot2
library(shiny) # criação de dashboard dinamico
library(DT) #construção de tabelas
library(readr)# leitura de arquivos csv txt
library(dplyr) # manipulação de dados
library(rsconnect)
library(leaflet) # mapas interativos
library(RColorBrewer) # paleta de cores para o mapa
library(ggplot2)# construção de gráficos
library(plyr)
library(kableExtra) #tabelas
library(DT)
library(rgdal) # para carregar o shape
library(rgdal) # leitura do shape
library(PROJ)
library(blob)
library(dbplyr)
library(fs)
library(modelr)
library(proj4)
library(reprex)
library(whisker)
library(descr)
shape<- readOGR("MT_Municipios_2019.shp", stringsAsFactors=FALSE, encoding="UTF-8")
## Warning in OGRSpatialRef(dsn, layer, morphFromESRI =
## morphFromESRI, dumpSRS = dumpSRS, : Discarded datum
## Sistema_de_Referencia_Geocentrico_para_las_AmericaS_2000 in Proj4 definition:
## +proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs
## OGR data source with driver: ESRI Shapefile
## Source: "C:\Users\mateusbarbosa\Documents\MT_Municipios_2019.shp", layer: "MT_Municipios_2019"
## with 141 features
## It has 4 fields
municipios<- read_excel("topico2.xlsx")
municipios2<-sprintf("R$ %.2f", municipios$pib)
municipios3<-sprintf("R$ %.2f", municipios$VABagro)
municipios3a<-sprintf("R$ %.2f", municipios$VABIndustria)
municipios3b <- sprintf("R$ %.2f", municipios$VABServicos)
municipios4<-cbind(municipios,municipios2)
municipios5<-cbind(municipios4,municipios3,municipios3a,municipios3b)
sojamt <-format(municipios5$soja, nsmall=2, big.mark=".")
## Warning in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, :
## 'big.mark' and 'decimal.mark' are both '.', which could be confusing
municipios5<-cbind(municipios4,municipios3,municipios3a,municipios3b,sojamt)
municipios <- as.data.frame(municipios5)
municipiosmt <- merge(shape,municipios, by.x = "CD_MUN", by.y = "codigo_ibge")
library(maptools)
## Warning: package 'maptools' was built under R version 4.0.5
## Checking rgeos availability: TRUE
library(maps)
## Warning: package 'maps' was built under R version 4.0.5
##
## Attaching package: 'maps'
## The following object is masked from 'package:plyr':
##
## ozone
## The following object is masked from 'package:purrr':
##
## map
library(dplyr)
library(RColorBrewer)
library(rgdal)
library(readr)
library(descr)
pal <- colorNumeric(
palette = "Accent",
domain = municipiosmt$cores)
municipiosmt$labels <- paste0("<strong> Municipio: </strong>",
municipiosmt$nome,
"<br><strong> Consórcio: </strong>",
municipiosmt$consorcio,
"<br><strong> PIB: </strong>",
municipiosmt$municipios2,
"<br><strong> VAB Indústria: </strong>",
municipiosmt$municipios3a,
"<br><strong> VAB Serviços: </strong>",
municipiosmt$municipios3b,
"<br><strong> VAB Agropecuária: </strong>",
municipiosmt$municipios3)%>%
lapply(htmltools::HTML)
leaflet(municipiosmt) %>%
addProviderTiles("OpenStreetMap") %>%
addPolygons(fillColor = ~pal(municipiosmt$cores),
smoothFactor = 0.5,
fillOpacity = 0.8,
weight = 1,
color = "white",
label = ~labels,
highlight = highlightOptions(
color = "white",
bringToFront = TRUE
))