library(readxl)
## Warning: package 'readxl' was built under R version 4.2.3
BasesMunicipios <- read_excel("C:/Users/17988111701/Downloads/BasesMunicipios.xlsx")
View(BasesMunicipios)

Análise do gráfico expectativa/esperança de vida no Município do Rio de Janeiro

library(readxl)
library(plotly)
## Warning: package 'plotly' was built under R version 4.2.3
## Carregando pacotes exigidos: ggplot2
## Warning: package 'ggplot2' was built under R version 4.2.3
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(geobr)
## Warning: package 'geobr' was built under R version 4.2.3
## Loading required namespace: sf
desenho_rio_municipio = read_municipality(code_muni = "RJ", showProgress = FALSE)
## Using year 2010
library(leaflet)
## Warning: package 'leaflet' was built under R version 4.2.3
mapa_lea = leaflet() %>%
  addTiles() %>%
  addCircles(lng = -43.2093, lat= -22.9035, popup="Rio de Janeiro")

mapa_lea
mapa_lea %>% addProviderTiles(providers$Esri.WorldImagery)
summary(BasesMunicipios)
##     Munic              Regiao             COD IBGE       COD IBGE2        
##  Length:92          Length:92          Min.   :330010   Length:92         
##  Class :character   Class :character   1st Qu.:330158   Class :character  
##  Mode  :character   Mode  :character   Median :330315   Mode  :character  
##                                        Mean   :330312                     
##                                        3rd Qu.:330463                     
##                                        Max.   :330630                     
##                                                                           
##       Gini             Agua          Banheiro          Lixo       
##  Min.   :0.4200   Min.   :63.90   Min.   :74.75   Min.   : 84.86  
##  1st Qu.:0.4700   1st Qu.:89.65   1st Qu.:92.33   1st Qu.: 97.17  
##  Median :0.4850   Median :94.13   Median :96.42   Median : 98.80  
##  Mean   :0.4897   Mean   :92.09   Mean   :94.66   Mean   : 97.91  
##  3rd Qu.:0.5100   3rd Qu.:96.61   3rd Qu.:97.92   3rd Qu.: 99.25  
##  Max.   :0.6200   Max.   :99.47   Max.   :99.83   Max.   :100.00  
##                                                                   
##     Energia         Densidade     Esperancadevida Mortalidade_infantil
##  Min.   : 98.02   Min.   :14.59   Min.   :71.93   Min.   :10.96       
##  1st Qu.: 99.77   1st Qu.:22.52   1st Qu.:73.26   1st Qu.:14.56       
##  Median : 99.89   Median :26.16   Median :73.74   Median :15.90       
##  Mean   : 99.79   Mean   :26.97   Mean   :73.96   Mean   :15.60       
##  3rd Qu.: 99.97   3rd Qu.:31.02   3rd Qu.:74.83   3rd Qu.:16.68       
##  Max.   :100.00   Max.   :46.83   Max.   :76.27   Max.   :18.60       
##                                                                       
##  Prob_sobrevivencia      IDH           IDH_Renda      IDH_Longevidade 
##  Min.   :90.27      Min.   :0.6110   Min.   :0.6180   Min.   :0.7820  
##  1st Qu.:91.28      1st Qu.:0.6847   1st Qu.:0.6827   1st Qu.:0.8040  
##  Median :91.65      Median :0.7125   Median :0.6985   Median :0.8125  
##  Mean   :91.79      Mean   :0.7089   Mean   :0.7046   Mean   :0.8161  
##  3rd Qu.:92.47      3rd Qu.:0.7300   3rd Qu.:0.7230   3rd Qu.:0.8303  
##  Max.   :93.55      Max.   :0.8370   Max.   :0.8870   Max.   :0.8550  
##                                                                       
##   IDH_Educacao    Probab_sobrev60      TFT        Taxa_envelhecimento
##  Min.   :0.4360   Min.   :77.59   Min.   :1.300   Min.   : 4.910     
##  1st Qu.:0.5920   1st Qu.:79.61   1st Qu.:1.680   1st Qu.: 7.242     
##  Median :0.6240   Median :80.38   Median :1.825   Median : 8.500     
##  Mean   :0.6209   Mean   :80.65   Mean   :1.848   Mean   : 8.584     
##  3rd Qu.:0.6530   3rd Qu.:81.80   3rd Qu.:2.020   3rd Qu.: 9.738     
##  Max.   :0.7730   Max.   :84.39   Max.   :2.500   Max.   :12.400     
##                                                                      
##  Taxa_analfabetismo frequencia_liquida_EM Expectativa_anos_de_estudo
##  Min.   : 2.470     Min.   :31.10         Min.   : 7.330            
##  1st Qu.: 6.220     1st Qu.:44.63         1st Qu.: 8.695            
##  Median : 8.705     Median :49.58         Median : 8.985            
##  Mean   : 9.489     Mean   :49.38         Mean   : 8.955            
##  3rd Qu.:12.240     3rd Qu.:54.08         3rd Qu.: 9.242            
##  Max.   :23.350     Max.   :70.49         Max.   :10.190            
##                                                                     
##  frequencia_liquida_Superior perc_com_2_anos_de_de_atraso Renda_per_capita
##  Min.   : 3.14               Min.   :14.74                Min.   : 375.5  
##  1st Qu.: 8.24               1st Qu.:21.16                1st Qu.: 559.5  
##  Median :10.76               Median :24.39                Median : 618.3  
##  Mean   :11.37               Mean   :23.96                Mean   : 666.0  
##  3rd Qu.:13.52               3rd Qu.:26.18                3rd Qu.: 718.1  
##  Max.   :36.40               Max.   :36.27                Max.   :2000.3  
##                                                                           
##  Renda_per_capita_nula  Perc_pobres    Perc_extremamente_pobres
##  Min.   : 385.1        Min.   : 3.34   Min.   : 0.110          
##  1st Qu.: 565.5        1st Qu.: 7.70   1st Qu.: 3.225          
##  Median : 625.0        Median :10.15   Median : 5.060          
##  Mean   : 668.3        Mean   :10.16   Mean   : 5.100          
##  3rd Qu.: 719.6        3rd Qu.:12.20   3rd Qu.: 6.185          
##  Max.   :2001.1        Max.   :23.92   Max.   :15.690          
##                                                                
##    Populacao            ISS           
##  Min.   :   5269   Min.   :1.235e+05  
##  1st Qu.:  17502   1st Qu.:1.024e+06  
##  Median :  34878   Median :4.021e+06  
##  Mean   : 173804   Mean   :7.203e+07  
##  3rd Qu.: 113948   3rd Qu.:1.657e+07  
##  Max.   :6320446   Max.   :3.723e+09  
##                    NA's   :15
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.2.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(flextable)
## Warning: package 'flextable' was built under R version 4.2.3
## 
## Attaching package: 'flextable'
## The following objects are masked from 'package:plotly':
## 
##     highlight, style