library(data.table)
library(tidyverse)
library(read.dbc)
library(foreign)
library(dplyr)
require("stringr")
require(summarytools)
library(rapportools)
source("http://pcwww.liv.ac.uk/~william/R/crosstab.r")
library(tibble)
library(readxl)
load("/cloud/project/binomial/bases finais/base_analise_ha_v2.RData")
load("/cloud/project/binomial/bases finais/bahia_pop_long.RData")

1 cenário de casos

1.1 Municipios com pelo menos uma ocorrência de arboviroses nos 4 anos.

library("tidyverse")
# seleciona municipios com pelo menos 1 caso de arbovirose
incid_arboviroses_ano<-base_analise_ha_v2%>%dplyr::select(mun,ano,dg_conf,chik_conf,zika_conf,populacao,semiarido)%>% filter(dg_conf>0 &chik_conf>0 & zika_conf>0)

mun_coc<-incid_arboviroses_ano%>%dplyr::select(mun)%>%
 group_by(mun)%>%  
 count() 

names(mun_coc)<-c("mun","freq")

mun_coc<-mun_coc%>%
dplyr::filter(freq==4)
municipios_todosanos<-mun_coc$mun
municipios_todosanos
[1] "BARREIRAS"           "EUNAPOLIS"           "FEIRA DE SANTANA"   
[4] "ILHEUS"              "RIBEIRA DO POMBAL"   "SALVADOR"           
[7] "TEIXEIRA DE FREITAS"

1.2 característica dos municípios

library("patchwork")
library("expss")

bahia_pop_long%>%dplyr::filter(mun%in%municipios_todosanos)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, semiarido,IDH,popporte)%>%
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,semiarido,IDH,popporte)%>%
  unique()%>%
  knitr::kable(.,"simple")
macrorregiao regiao.de.saude mun semiarido IDH popporte
3 Centro-Leste Feira de Santana FEIRA DE SANTANA 1 ALTO Grande Porte
2 Extremo Sul Porto Seguro EUNAPOLIS 0 ALTO Grande Porte
7 Extremo Sul Teixeira de Freitas TEIXEIRA DE FREITAS 0 ALTO Grande Porte
6 Leste Salvador SALVADOR 0 MUITO ALTO Metrópole
5 Nordeste Ribeira do Pombal RIBEIRA DO POMBAL 1 MEDIO Pequeno Porte II
1 Oeste Barreiras BARREIRAS 1 ALTO Grande Porte
4 Sul Ilheus ILHEUS 0 ALTO Grande Porte
bahia_pop_long%>%dplyr::filter(mun%in%municipios_todosanos)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, pop, semiarido,bioma_2014,newtipology,IDH,popporte)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
 # sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,IDH,popporte)%>%
  group_by(semiarido)%>%
  dfSummary(style='multiline', graph.col = FALSE)
Data Frame Summary  
bahia_pop_long  
Group: semiarido = regiao arida  
Dimensions: 3 x 9  
Duplicates: 0  

------------------------------------------------------------------------------------------------------------------------------------
No   Variable          Label                                   Stats / Values              Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------------------- --------------------------- -------------------- ---------- ---------
1    macrorregiao                                              1. Centro-Leste             1 (33.3%)            3          0        
     [character]                                               2. Nordeste                 1 (33.3%)            (100.0%)   (0.0%)   
                                                               3. Oeste                    1 (33.3%)                                

2    regiao.de.saude                                           1. Barreiras                1 (33.3%)            3          0        
     [character]                                               2. Feira de Santana         1 (33.3%)            (100.0%)   (0.0%)   
                                                               3. Ribeira do Pombal        1 (33.3%)                                

3    mun                                                       1. BARREIRAS                1 (33.3%)            3          0        
     [character]                                               2. FEIRA DE SANTANA         1 (33.3%)            (100.0%)   (0.0%)   
                                                               3. RIBEIRA DO POMBAL        1 (33.3%)                                

4    pop                                                       Mean (sd) : 181.2 (256.8)   19.79 : 1 (33.3%)    3          0        
     [numeric]                                                 min < med < max:            46.52 : 1 (33.3%)    (100.0%)   (0.0%)   
                                                               19.8 < 46.5 < 477.3         477.33 : 1 (33.3%)                       
                                                               IQR (CV) : 228.8 (1.4)                                               

6    bioma_2014                                                1. Agropecuária             2 (66.7%)            3          0        
     [character]                                               2. Floresta                 1 (33.3%)            (100.0%)   (0.0%)   

7    newtipology                                               1. Urbano                   3 (100.0%)           3          0        
     [character]                                                                                                (100.0%)   (0.0%)   

8    IDH                                                       1. ALTO                     2 (66.7%)            3          0        
     [character]                                               2. MEDIO                    1 (33.3%)            (100.0%)   (0.0%)   

9    popporte          Porte da Populacao segundo Censo IBGE   1. Grande Porte             2 (66.7%)            3          0        
     [character]       2010                                    2. Pequeno Porte II         1 (33.3%)            (100.0%)   (0.0%)   
------------------------------------------------------------------------------------------------------------------------------------

Group: semiarido = regiao nao seca  
Dimensions: 4 x 9  
Duplicates: 0  

-------------------------------------------------------------------------------------------------------------------------------------
No   Variable          Label                                   Stats / Values              Freqs (% of Valid)    Valid      Missing  
---- ----------------- --------------------------------------- --------------------------- --------------------- ---------- ---------
1    macrorregiao                                              1. Extremo Sul              2 (50.0%)             4          0        
     [character]                                               2. Leste                    1 (25.0%)             (100.0%)   (0.0%)   
                                                               3. Sul                      1 (25.0%)                                 

2    regiao.de.saude                                           1. Ilheus                   1 (25.0%)             4          0        
     [character]                                               2. Porto Seguro             1 (25.0%)             (100.0%)   (0.0%)   
                                                               3. Salvador                 1 (25.0%)                                 
                                                               4. Teixeira de Freitas      1 (25.0%)                                 

3    mun                                                       1. EUNAPOLIS                1 (25.0%)             4          0        
     [character]                                               2. ILHEUS                   1 (25.0%)             (100.0%)   (0.0%)   
                                                               3. SALVADOR                 1 (25.0%)                                 
                                                               4. TEIXEIRA DE FREITAS      1 (25.0%)                                 

4    pop                                                       Mean (sd) : 1141 (2062.5)   80.14 : 1 (25.0%)     4          0        
     [numeric]                                                 min < med < max:            112.18 : 1 (25.0%)    (100.0%)   (0.0%)   
                                                               80.1 < 124.6 < 4234.6       137.11 : 1 (25.0%)                        
                                                               IQR (CV) : 1057.3 (1.8)     4234.59 : 1 (25.0%)                       

6    bioma_2014                                                1. Agropecuária             2 (50.0%)             4          0        
     [character]                                               2. Corpos d’água            1 (25.0%)             (100.0%)   (0.0%)   
                                                               3. Floresta                 1 (25.0%)                                 

7    newtipology                                               1. Urbano                   4 (100.0%)            4          0        
     [character]                                                                                                 (100.0%)   (0.0%)   

8    IDH                                                       1. ALTO                     3 (75.0%)             4          0        
     [character]                                               2. MUITO ALTO               1 (25.0%)             (100.0%)   (0.0%)   

9    popporte          Porte da Populacao segundo Censo IBGE   1. Grande Porte             3 (75.0%)             4          0        
     [character]       2010                                    2. Metrópole                1 (25.0%)             (100.0%)   (0.0%)   
-------------------------------------------------------------------------------------------------------------------------------------

1.3 dengue municipios ao longo dos 4 anos

dg<-base_analise_ha_v2%>%dplyr::select(mun,ano,dg_conf)%>%
 dplyr::filter(dg_conf>0)%>%
 group_by(ano)

dg_mun_2016<-dg$mun[dg$ano==2016]
dg_mun_2017<-dg$mun[dg$ano==2017]
dg_mun_2018<-dg$mun[dg$ano==2018]
dg_mun_2019<-dg$mun[dg$ano==2019]
uni_16_17<-intersect(dg_mun_2016,dg_mun_2017)
uni_161718<-intersect(uni_16_17,dg_mun_2018)
dg_uni_16171819<-intersect(uni_161718,dg_mun_2019)
dg_uni_16171819
 [1] "ABAIRA"                    "ALAGOINHAS"               
 [3] "AMERICA DOURADA"           "BARREIRAS"                
 [5] "BELMONTE"                  "BOM JESUS DA LAPA"        
 [7] "BRUMADO"                   "BURITIRAMA"               
 [9] "CAETITE"                   "CAMACARI"                 
[11] "CORRENTINA"                "CRISTOPOLIS"              
[13] "CRUZ DAS ALMAS"            "DIAS D AVILA"             
[15] "EUNAPOLIS"                 "FEIRA DE SANTANA"         
[17] "FLORESTA AZUL"             "IBICARAI"                 
[19] "IBIPITANGA"                "ILHEUS"                   
[21] "IRAQUARA"                  "IRECE"                    
[23] "ITABUNA"                   "ITAMARAJU"                
[25] "ITANHEM"                   "ITIUBA"                   
[27] "ITORORO"                   "JABORANDI"                
[29] "JACOBINA"                  "JAGUAQUARA"               
[31] "JEQUIE"                    "JUAZEIRO"                 
[33] "LAURO DE FREITAS"          "LUIS EDUARDO MAGALHAES"   
[35] "MACAUBAS"                  "MEDEIROS NETO"            
[37] "MORRO DO CHAPEU"           "MUCURI"                   
[39] "MURITIBA"                  "NOVO HORIZONTE"           
[41] "OLIVEIRA DOS BREJINHOS"    "PARAMIRIM"                
[43] "PARATINGA"                 "PAULO AFONSO"             
[45] "PORTO SEGURO"              "PRESIDENTE TANCREDO NEVES"
[47] "REMANSO"                   "RIACHO DE SANTANA"        
[49] "RIBEIRA DO POMBAL"         "SALVADOR"                 
[51] "SANTA MARIA DA VITORIA"    "SANTO ANTONIO DE JESUS"   
[53] "SANTO ESTEVAO"             "SAO DESIDERIO"            
[55] "SAO DOMINGOS"              "SAO FELIX DO CORIBE"      
[57] "SEABRA"                    "SENHOR DO BONFIM"         
[59] "SERRINHA"                  "SERROLANDIA"              
[61] "SIMOES FILHO"              "SITIO DO MATO"            
[63] "TANQUINHO"                 "TEIXEIRA DE FREITAS"      
[65] "UIBAI"                     "UNA"                      
[67] "VARZEA NOVA"               "VERA CRUZ"                
[69] "VITORIA DA CONQUISTA"      "WANDERLEY"                

1.4 chikungunya municipios ao longo dos 4 anos

ck<-base_analise_ha_v2%>%dplyr::select(mun,ano,chik_conf)%>%
 dplyr::filter(chik_conf>0)%>%
 group_by(ano)

ck_mun_2016<-ck$mun[ck$ano==2016]
ck_mun_2017<-ck$mun[ck$ano==2017]
ck_mun_2018<-ck$mun[ck$ano==2018]
ck_mun_2019<-ck$mun[ck$ano==2019]
uni_16_17<-intersect(ck_mun_2016,ck_mun_2017)
uni_161718<-intersect(uni_16_17,ck_mun_2018)
ck_uni_16171819<-intersect(uni_161718,ck_mun_2019)
ck_uni_16171819
 [1] "BARREIRAS"            "CANDEIAS"             "CARAVELAS"           
 [4] "EUNAPOLIS"            "FEIRA DE SANTANA"     "ILHEUS"              
 [7] "IRECE"                "ITABUNA"              "ITAMARAJU"           
[10] "ITANHEM"              "MACAUBAS"             "PORTO SEGURO"        
[13] "RIBEIRA DO POMBAL"    "SALVADOR"             "SAO DESIDERIO"       
[16] "SENHOR DO BONFIM"     "TEIXEIRA DE FREITAS"  "VITORIA DA CONQUISTA"

1.5 zika municipios ao longo dos 4 anos

zk<-base_analise_ha_v2%>%dplyr::select(mun,ano,zika_conf)%>%
 dplyr::filter(zika_conf>0)%>%
 group_by(ano)

zk_mun_2016<-zk$mun[zk$ano==2016]
zk_mun_2017<-zk$mun[zk$ano==2017]
zk_mun_2018<-zk$mun[zk$ano==2018]
zk_mun_2019<-zk$mun[zk$ano==2019]
uni_16_17<-intersect(ck_mun_2016,zk_mun_2017)
uni_161718<-intersect(uni_16_17,zk_mun_2018)
zk_uni_16171819<-intersect(uni_161718,zk_mun_2019)
zk_uni_16171819
 [1] "BARREIRAS"           "EUNAPOLIS"           "FEIRA DE SANTANA"   
 [4] "ILHEUS"              "ITABELA"             "LAURO DE FREITAS"   
 [7] "PRADO"               "REMANSO"             "RIBEIRA DO POMBAL"  
[10] "SALVADOR"            "TEIXEIRA DE FREITAS"

2 municípios com casos de dengue e chikungunya

dg_uni_chik<-intersect(dg_uni_16171819,ck_uni_16171819)
dg_uni_chik
 [1] "BARREIRAS"            "EUNAPOLIS"            "FEIRA DE SANTANA"    
 [4] "ILHEUS"               "IRECE"                "ITABUNA"             
 [7] "ITAMARAJU"            "ITANHEM"              "MACAUBAS"            
[10] "PORTO SEGURO"         "RIBEIRA DO POMBAL"    "SALVADOR"            
[13] "SAO DESIDERIO"        "SENHOR DO BONFIM"     "TEIXEIRA DE FREITAS" 
[16] "VITORIA DA CONQUISTA"

2.1 Municipios com casos de dengue e chikungunya fora cocirculação bahia total

#library("prob")
dg_chik<-setdiff(dg_uni_chik,municipios_todosanos)
dg_chik
[1] "IRECE"                "ITABUNA"              "ITAMARAJU"           
[4] "ITANHEM"              "MACAUBAS"             "PORTO SEGURO"        
[7] "SAO DESIDERIO"        "SENHOR DO BONFIM"     "VITORIA DA CONQUISTA"

#dg_chik ### caracteristica dos municipios

bahia_pop_long%>%dplyr::filter(mun%in%dg_chik)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, semiarido,IDH,popporte)%>%
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,semiarido,IDH,popporte)%>%
  unique()%>%
  knitr::kable(.,"simple")
macrorregiao regiao.de.saude mun semiarido IDH popporte
1 Centro-Norte Irece IRECE 1 ALTO Médio Porte
6 Extremo Sul Porto Seguro PORTO SEGURO 0 ALTO Grande Porte
3 Extremo Sul Teixeira de Freitas ITAMARAJU 0 ALTO Médio Porte
4 Extremo Sul Teixeira de Freitas ITANHEM 0 ALTO Pequeno Porte II
8 Norte Senhor do Bonfim SENHOR DO BONFIM 1 ALTO Médio Porte
7 Oeste Barreiras SAO DESIDERIO 0 MEDIO Pequeno Porte II
5 Sudoeste Brumado MACAUBAS 1 MEDIO Pequeno Porte II
9 Sudoeste Vitoria da Conquista VITORIA DA CONQUISTA 1 ALTO Grande Porte
2 Sul Itabuna ITABUNA 0 ALTO Grande Porte
bahia_pop_long%>%dplyr::filter(mun%in%dg_chik)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, pop, semiarido,bioma_2014,newtipology,IDH,popporte)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
 # sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,IDH,popporte)%>%
  group_by(semiarido)%>%
  dfSummary(style='multiline', graph.col = FALSE)
Data Frame Summary  
bahia_pop_long  
Group: semiarido = regiao arida  
Dimensions: 4 x 9  
Duplicates: 0  

----------------------------------------------------------------------------------------------------------------------------------
No   Variable          Label                                   Stats / Values            Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------------------- ------------------------- -------------------- ---------- ---------
1    macrorregiao                                              1. Centro-Norte           1 (25.0%)            4          0        
     [character]                                               2. Norte                  1 (25.0%)            (100.0%)   (0.0%)   
                                                               3. Sudoeste               2 (50.0%)                                

2    regiao.de.saude                                           1. Brumado                1 (25.0%)            4          0        
     [character]                                               2. Irece                  1 (25.0%)            (100.0%)   (0.0%)   
                                                               3. Senhor do Bonfim       1 (25.0%)                                
                                                               4. Vitoria da Conquista   1 (25.0%)                                

3    mun                                                       1. IRECE                  1 (25.0%)            4          0        
     [character]                                               2. MACAUBAS               1 (25.0%)            (100.0%)   (0.0%)   
                                                               3. SENHOR DO BONFIM       1 (25.0%)                                
                                                               4. VITORIA DA CONQUISTA   1 (25.0%)                                

4    pop                                                       Mean (sd) : 112 (87.7)    20.59 : 1 (25.0%)    4          0        
     [numeric]                                                 min < med < max:          93.38 : 1 (25.0%)    (100.0%)   (0.0%)   
                                                               20.6 < 97.8 < 231.6       102.32 : 1 (25.0%)                       
                                                               IQR (CV) : 59.5 (0.8)     231.58 : 1 (25.0%)                       

6    bioma_2014                                                1. Agropecuária           3 (75.0%)            4          0        
     [character]                                               2. Floresta               1 (25.0%)            (100.0%)   (0.0%)   

7    newtipology                                               1. ruralremoto            1 (25.0%)            4          0        
     [character]                                               2. Urbano                 3 (75.0%)            (100.0%)   (0.0%)   

8    IDH                                                       1. ALTO                   3 (75.0%)            4          0        
     [character]                                               2. MEDIO                  1 (25.0%)            (100.0%)   (0.0%)   

9    popporte          Porte da Populacao segundo Censo IBGE   1. Grande Porte           1 (25.0%)            4          0        
     [character]       2010                                    2. Médio Porte            2 (50.0%)            (100.0%)   (0.0%)   
                                                               3. Pequeno Porte II       1 (25.0%)                                
----------------------------------------------------------------------------------------------------------------------------------

Group: semiarido = regiao nao seca  
Dimensions: 5 x 9  
Duplicates: 0  

------------------------------------------------------------------------------------------------------------------------------------
No   Variable          Label                                   Stats / Values              Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------------------- --------------------------- -------------------- ---------- ---------
1    macrorregiao                                              1. Extremo Sul              3 (60.0%)            5          0        
     [character]                                               2. Oeste                    1 (20.0%)            (100.0%)   (0.0%)   
                                                               3. Sul                      1 (20.0%)                                

2    regiao.de.saude                                           1. Barreiras                1 (20.0%)            5          0        
     [character]                                               2. Itabuna                  1 (20.0%)            (100.0%)   (0.0%)   
                                                               3. Porto Seguro             1 (20.0%)                                
                                                               4. Teixeira de Freitas      2 (40.0%)                                

3    mun                                                       1. ITABUNA                  1 (20.0%)            5          0        
     [character]                                               2. ITAMARAJU                1 (20.0%)            (100.0%)   (0.0%)   
                                                               3. ITANHEM                  1 (20.0%)                                
                                                               4. PORTO SEGURO             1 (20.0%)                                
                                                               5. SAO DESIDERIO            1 (20.0%)                                

4    pop                                                       Mean (sd) : 131.9 (234.6)   2.19 : 1 (20.0%)     5          0        
     [numeric]                                                 min < med < max:            14.74 : 1 (20.0%)    (100.0%)   (0.0%)   
                                                               2.2 < 28.5 < 549.5          28.52 : 1 (20.0%)                        
                                                               IQR (CV) : 49.8 (1.8)       64.51 : 1 (20.0%)                        
                                                                                           549.55 : 1 (20.0%)                       

6    bioma_2014                                                1. Agropecuária             3 (60.0%)            5          0        
     [character]                                               2. Floresta                 2 (40.0%)            (100.0%)   (0.0%)   

7    newtipology                                               1. intermediarioadjacente   1 (20.0%)            5          0        
     [character]                                               2. ruraladjacente           1 (20.0%)            (100.0%)   (0.0%)   
                                                               3. Urbano                   3 (60.0%)                                

8    IDH                                                       1. ALTO                     4 (80.0%)            5          0        
     [character]                                               2. MEDIO                    1 (20.0%)            (100.0%)   (0.0%)   

9    popporte          Porte da Populacao segundo Censo IBGE   1. Grande Porte             2 (40.0%)            5          0        
     [character]       2010                                    2. Médio Porte              1 (20.0%)            (100.0%)   (0.0%)   
                                                               3. Pequeno Porte II         2 (40.0%)                                
------------------------------------------------------------------------------------------------------------------------------------

3 municípios só com casos de chikungunya (sem dengue)

chik_notdg<-setdiff(ck_uni_16171819,dg_uni_16171819)
chik_notdg
[1] "CANDEIAS"  "CARAVELAS"

3.0.1 característica dos municípios

bahia_pop_long%>%dplyr::filter(mun%in%chik_notdg)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, semiarido,IDH,popporte)%>%
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,semiarido,IDH,popporte)%>%
  unique()%>%
  knitr::kable(.,"simple")
macrorregiao regiao.de.saude mun semiarido IDH popporte
2 Extremo Sul Teixeira de Freitas CARAVELAS 0 MEDIO Pequeno Porte II
1 Leste Salvador CANDEIAS 0 ALTO Médio Porte
bahia_pop_long%>%dplyr::filter(mun%in%chik_notdg)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, pop, semiarido,bioma_2014,newtipology,IDH,popporte)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
 # sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,IDH,popporte)%>%
  group_by(semiarido)%>%
  dfSummary(style='multiline', graph.col = FALSE)
Data Frame Summary  
bahia_pop_long  
Group: semiarido = regiao nao seca  
Dimensions: 2 x 9  
Duplicates: 0  

---------------------------------------------------------------------------------------------------------------------------------
No   Variable          Label                                   Stats / Values           Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------------------- ------------------------ -------------------- ---------- ---------
1    macrorregiao                                              1. Extremo Sul           1 (50.0%)            2          0        
     [character]                                               2. Leste                 1 (50.0%)            (100.0%)   (0.0%)   

2    regiao.de.saude                                           1. Salvador              1 (50.0%)            2          0        
     [character]                                               2. Teixeira de Freitas   1 (50.0%)            (100.0%)   (0.0%)   

3    mun                                                       1. CANDEIAS              1 (50.0%)            2          0        
     [character]                                               2. CARAVELAS             1 (50.0%)            (100.0%)   (0.0%)   

4    pop                                                       Min  : 9.5               9.52 : 1 (50.0%)     2          0        
     [numeric]                                                 Mean : 182.1             354.77 : 1 (50.0%)   (100.0%)   (0.0%)   
                                                               Max  : 354.8                                                      

6    bioma_2014                                                1. Agropecuária          1 (50.0%)            2          0        
     [character]                                               2. Floresta              1 (50.0%)            (100.0%)   (0.0%)   

7    newtipology                                               1. ruraladjacente        1 (50.0%)            2          0        
     [character]                                               2. Urbano                1 (50.0%)            (100.0%)   (0.0%)   

8    IDH                                                       1. ALTO                  1 (50.0%)            2          0        
     [character]                                               2. MEDIO                 1 (50.0%)            (100.0%)   (0.0%)   

9    popporte          Porte da Populacao segundo Censo IBGE   1. Médio Porte           1 (50.0%)            2          0        
     [character]       2010                                    2. Pequeno Porte II      1 (50.0%)            (100.0%)   (0.0%)   
---------------------------------------------------------------------------------------------------------------------------------

4 municípios casos de dengue e zika

dg_uni_zk<-intersect(dg_uni_16171819,zk_uni_16171819)
dg_uni_zk
[1] "BARREIRAS"           "EUNAPOLIS"           "FEIRA DE SANTANA"   
[4] "ILHEUS"              "LAURO DE FREITAS"    "REMANSO"            
[7] "RIBEIRA DO POMBAL"   "SALVADOR"            "TEIXEIRA DE FREITAS"

4.1 Municipios com casos de dengue e zika fora cocirculação bahia total

#library("prob")
dg_zk<-setdiff(dg_uni_zk,municipios_todosanos)
dg_zk
[1] "LAURO DE FREITAS" "REMANSO"         

4.1.1 característica dos municípios

bahia_pop_long%>%dplyr::filter(mun%in%dg_zk)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, semiarido,IDH,popporte,newtipology,bioma_2014)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,semiarido,IDH,popporte)%>%
  unique()%>%
  knitr::kable(.,"simple")
macrorregiao regiao.de.saude mun semiarido IDH popporte newtipology bioma_2014
Leste Salvador LAURO DE FREITAS regiao nao seca MUITO ALTO Grande Porte Urbano Area não vegetada
Norte Juazeiro REMANSO regiao arida MEDIO Pequeno Porte II intermediarioadjacente Floresta
bahia_pop_long%>%dplyr::filter(mun%in%dg_zk)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, pop, semiarido,bioma_2014,newtipology,IDH,popporte)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
 # sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,IDH,popporte)%>%
  group_by(semiarido)%>%
  dfSummary(style='multiline', graph.col = FALSE)
Data Frame Summary  
bahia_pop_long  
Group: semiarido = regiao arida  
Dimensions: 1 x 9  
Duplicates: 0  

------------------------------------------------------------------------------------------------------------------------------------
No   Variable          Label                                   Stats / Values              Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------------------- --------------------------- -------------------- ---------- ---------
1    macrorregiao                                              1. Norte                    1 (100.0%)           1          0        
     [character]                                                                                                (100.0%)   (0.0%)   

2    regiao.de.saude                                           1. Juazeiro                 1 (100.0%)           1          0        
     [character]                                                                                                (100.0%)   (0.0%)   

3    mun                                                       1. REMANSO                  1 (100.0%)           1          0        
     [character]                                                                                                (100.0%)   (0.0%)   

4    pop                                                       1 distinct value            9.07 : 1 (100.0%)    1          0        
     [numeric]                                                                                                  (100.0%)   (0.0%)   

6    bioma_2014                                                1. Floresta                 1 (100.0%)           1          0        
     [character]                                                                                                (100.0%)   (0.0%)   

7    newtipology                                               1. intermediarioadjacente   1 (100.0%)           1          0        
     [character]                                                                                                (100.0%)   (0.0%)   

8    IDH                                                       1. MEDIO                    1 (100.0%)           1          0        
     [character]                                                                                                (100.0%)   (0.0%)   

9    popporte          Porte da Populacao segundo Censo IBGE   1. Pequeno Porte II         1 (100.0%)           1          0        
     [character]       2010                                                                                     (100.0%)   (0.0%)   
------------------------------------------------------------------------------------------------------------------------------------

Group: semiarido = regiao nao seca  
Dimensions: 1 x 9  
Duplicates: 0  

---------------------------------------------------------------------------------------------------------------------------------
No   Variable          Label                                   Stats / Values         Freqs (% of Valid)     Valid      Missing  
---- ----------------- --------------------------------------- ---------------------- ---------------------- ---------- ---------
1    macrorregiao                                              1. Leste               1 (100.0%)             1          0        
     [character]                                                                                             (100.0%)   (0.0%)   

2    regiao.de.saude                                           1. Salvador            1 (100.0%)             1          0        
     [character]                                                                                             (100.0%)   (0.0%)   

3    mun                                                       1. LAURO DE FREITAS    1 (100.0%)             1          0        
     [character]                                                                                             (100.0%)   (0.0%)   

4    pop                                                       1 distinct value       3375.43 : 1 (100.0%)   1          0        
     [numeric]                                                                                               (100.0%)   (0.0%)   

6    bioma_2014                                                1. Area não vegetada   1 (100.0%)             1          0        
     [character]                                                                                             (100.0%)   (0.0%)   

7    newtipology                                               1. Urbano              1 (100.0%)             1          0        
     [character]                                                                                             (100.0%)   (0.0%)   

8    IDH                                                       1. MUITO ALTO          1 (100.0%)             1          0        
     [character]                                                                                             (100.0%)   (0.0%)   

9    popporte          Porte da Populacao segundo Censo IBGE   1. Grande Porte        1 (100.0%)             1          0        
     [character]       2010                                                                                  (100.0%)   (0.0%)   
---------------------------------------------------------------------------------------------------------------------------------

4.2 municípios só com casos de zika (sem dengue)

zk_notdg<-setdiff(zk_uni_16171819,dg_uni_16171819)
zk_notdg
[1] "ITABELA" "PRADO"  

4.2.1 característica dos municípios

bahia_pop_long%>%dplyr::filter(mun%in%zk_notdg)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, semiarido,IDH,popporte,newtipology,bioma_2014)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,semiarido,IDH,popporte)%>%
  unique()%>%
  knitr::kable(.,"simple")
macrorregiao regiao.de.saude mun semiarido IDH popporte newtipology bioma_2014
Extremo Sul Porto Seguro ITABELA regiao nao seca MEDIO Pequeno Porte II Urbano Agropecuária
Extremo Sul Teixeira de Freitas PRADO regiao nao seca MEDIO Pequeno Porte II ruraladjacente Agropecuária
bahia_pop_long%>%dplyr::filter(mun%in%zk_notdg)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, pop, semiarido,bioma_2014,newtipology,IDH,popporte)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,IDH,popporte)%>%
  group_by(semiarido)%>%
dfSummary(style='multiline', graph.col = FALSE)
Data Frame Summary  
bahia_pop_long  
Group: semiarido = regiao nao seca  
Dimensions: 2 x 9  
Duplicates: 0  

-----------------------------------------------------------------------------------------
No   Variable          Stats / Values           Freqs (% of Valid)   Valid      Missing  
---- ----------------- ------------------------ -------------------- ---------- ---------
1    macrorregiao      1. Extremo Sul           2 (100.0%)           2          0        
     [character]                                                     (100.0%)   (0.0%)   

2    regiao.de.saude   1. Porto Seguro          1 (50.0%)            2          0        
     [character]       2. Teixeira de Freitas   1 (50.0%)            (100.0%)   (0.0%)   

3    mun               1. ITABELA               1 (50.0%)            2          0        
     [character]       2. PRADO                 1 (50.0%)            (100.0%)   (0.0%)   

4    pop               Min  : 17.3              17.34 : 1 (50.0%)    2          0        
     [numeric]         Mean : 25.6              33.78 : 1 (50.0%)    (100.0%)   (0.0%)   
                       Max  : 33.8                                                       

6    bioma_2014        1. Agropecuária          2 (100.0%)           2          0        
     [character]                                                     (100.0%)   (0.0%)   

7    newtipology       1. ruraladjacente        1 (50.0%)            2          0        
     [character]       2. Urbano                1 (50.0%)            (100.0%)   (0.0%)   

8    IDH               1. MEDIO                 2 (100.0%)           2          0        
     [character]                                                     (100.0%)   (0.0%)   

9    popporte          1. Pequeno Porte II      2 (100.0%)           2          0        
     [character]                                                     (100.0%)   (0.0%)   
-----------------------------------------------------------------------------------------

4.3 municipios com casos de chikungunya e zika

ck_uni_zk<-intersect(ck_uni_16171819,zk_uni_16171819)
ck_uni_zk
[1] "BARREIRAS"           "EUNAPOLIS"           "FEIRA DE SANTANA"   
[4] "ILHEUS"              "RIBEIRA DO POMBAL"   "SALVADOR"           
[7] "TEIXEIRA DE FREITAS"

4.4 Municipios com casos de chikungunya e zika fora cocirculação bahia total

#library("prob")
ck_zk<-setdiff(ck_uni_zk,municipios_todosanos)
ck_zk
character(0)

4.5 municípios só com casos de zika (sem chikungunya)

zk_notchik<-setdiff(zk_uni_16171819,ck_uni_16171819)
zk_notchik
[1] "ITABELA"          "LAURO DE FREITAS" "PRADO"            "REMANSO"         

4.5.1 característica dos municípios

bahia_pop_long%>%dplyr::filter(mun%in%zk_notchik)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, semiarido,IDH,popporte,newtipology,bioma_2014)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,semiarido,IDH,popporte)%>%
  unique()%>%
  knitr::kable(.,"simple")
macrorregiao regiao.de.saude mun semiarido IDH popporte newtipology bioma_2014
1 Extremo Sul Porto Seguro ITABELA regiao nao seca MEDIO Pequeno Porte II Urbano Agropecuária
3 Extremo Sul Teixeira de Freitas PRADO regiao nao seca MEDIO Pequeno Porte II ruraladjacente Agropecuária
2 Leste Salvador LAURO DE FREITAS regiao nao seca MUITO ALTO Grande Porte Urbano Area não vegetada
4 Norte Juazeiro REMANSO regiao arida MEDIO Pequeno Porte II intermediarioadjacente Floresta
bahia_pop_long%>%dplyr::filter(mun%in%zk_notchik)%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, pop, semiarido,bioma_2014,newtipology,IDH,popporte)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,semiarido,IDH,popporte)%>%
  group_by(semiarido)%>%
dfSummary(style='multiline', graph.col = FALSE)
Data Frame Summary  
bahia_pop_long  
Group: semiarido = regiao arida  
Dimensions: 1 x 9  
Duplicates: 0  

--------------------------------------------------------------------------------------------
No   Variable          Stats / Values              Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------- -------------------- ---------- ---------
1    macrorregiao      1. Norte                    1 (100.0%)           1          0        
     [character]                                                        (100.0%)   (0.0%)   

2    regiao.de.saude   1. Juazeiro                 1 (100.0%)           1          0        
     [character]                                                        (100.0%)   (0.0%)   

3    mun               1. REMANSO                  1 (100.0%)           1          0        
     [character]                                                        (100.0%)   (0.0%)   

4    pop               1 distinct value            9.07 : 1 (100.0%)    1          0        
     [numeric]                                                          (100.0%)   (0.0%)   

6    bioma_2014        1. Floresta                 1 (100.0%)           1          0        
     [character]                                                        (100.0%)   (0.0%)   

7    newtipology       1. intermediarioadjacente   1 (100.0%)           1          0        
     [character]                                                        (100.0%)   (0.0%)   

8    IDH               1. MEDIO                    1 (100.0%)           1          0        
     [character]                                                        (100.0%)   (0.0%)   

9    popporte          1. Pequeno Porte II         1 (100.0%)           1          0        
     [character]                                                        (100.0%)   (0.0%)   
--------------------------------------------------------------------------------------------

Group: semiarido = regiao nao seca  
Dimensions: 3 x 9  
Duplicates: 0  

-----------------------------------------------------------------------------------------------
No   Variable          Stats / Values                Freqs (% of Valid)    Valid      Missing  
---- ----------------- ----------------------------- --------------------- ---------- ---------
1    macrorregiao      1. Extremo Sul                2 (66.7%)             3          0        
     [character]       2. Leste                      1 (33.3%)             (100.0%)   (0.0%)   

2    regiao.de.saude   1. Porto Seguro               1 (33.3%)             3          0        
     [character]       2. Salvador                   1 (33.3%)             (100.0%)   (0.0%)   
                       3. Teixeira de Freitas        1 (33.3%)                                 

3    mun               1. ITABELA                    1 (33.3%)             3          0        
     [character]       2. LAURO DE FREITAS           1 (33.3%)             (100.0%)   (0.0%)   
                       3. PRADO                      1 (33.3%)                                 

4    pop               Mean (sd) : 1142.2 (1934.1)   17.34 : 1 (33.3%)     3          0        
     [numeric]         min < med < max:              33.78 : 1 (33.3%)     (100.0%)   (0.0%)   
                       17.3 < 33.8 < 3375.4          3375.43 : 1 (33.3%)                       
                       IQR (CV) : 1679 (1.7)                                                   

6    bioma_2014        1. Agropecuária               2 (66.7%)             3          0        
     [character]       2. Area não vegetada          1 (33.3%)             (100.0%)   (0.0%)   

7    newtipology       1. ruraladjacente             1 (33.3%)             3          0        
     [character]       2. Urbano                     2 (66.7%)             (100.0%)   (0.0%)   

8    IDH               1. MEDIO                      2 (66.7%)             3          0        
     [character]       2. MUITO ALTO                 1 (33.3%)             (100.0%)   (0.0%)   

9    popporte          1. Grande Porte               1 (33.3%)             3          0        
     [character]       2. Pequeno Porte II           2 (66.7%)             (100.0%)   (0.0%)   
-----------------------------------------------------------------------------------------------

5 característica dos municípios do Extremo Sul

bahia_pop_long%>%dplyr::filter(macrorregiao== "Extremo Sul")%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, semiarido,IDH,popporte,newtipology,bioma_2014)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,semiarido,IDH)%>%
  group_by(semiarido)%>%
  unique()%>%
  dfSummary(style='multiline', graph.col = FALSE)
Data Frame Summary  
bahia_pop_long  
Group: semiarido = regiao nao seca  
Dimensions: 21 x 8  
Duplicates: 0  

--------------------------------------------------------------------------------------------
No   Variable          Stats / Values              Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------- -------------------- ---------- ---------
1    macrorregiao      1. Extremo Sul              21 (100.0%)          21         0        
     [character]                                                        (100.0%)   (0.0%)   

2    regiao.de.saude   1. Porto Seguro              8 (38.1%)           21         0        
     [character]       2. Teixeira de Freitas      13 (61.9%)           (100.0%)   (0.0%)   

3    mun               1. ALCOBACA                  1 ( 4.8%)           21         0        
     [character]       2. BELMONTE                  1 ( 4.8%)           (100.0%)   (0.0%)   
                       3. CARAVELAS                 1 ( 4.8%)                               
                       4. EUNAPOLIS                 1 ( 4.8%)                               
                       5. GUARATINGA                1 ( 4.8%)                               
                       6. IBIRAPUA                  1 ( 4.8%)                               
                       7. ITABELA                   1 ( 4.8%)                               
                       8. ITAGIMIRIM                1 ( 4.8%)                               
                       9. ITAMARAJU                 1 ( 4.8%)                               
                       10. ITANHEM                  1 ( 4.8%)                               
                       [ 11 others ]               11 (52.4%)                               

5    IDH               1. ALTO                     10 (47.6%)           21         0        
     [character]       2. MEDIO                    11 (52.4%)           (100.0%)   (0.0%)   

6    popporte          1. Grande Porte              3 (14.3%)           21         0        
     [character]       2. Médio Porte               1 ( 4.8%)           (100.0%)   (0.0%)   
                       3. Pequeno Porte I           6 (28.6%)                               
                       4. Pequeno Porte II         11 (52.4%)                               

7    newtipology       1. intermediarioadjacente   6 (28.6%)            21         0        
     [character]       2. ruraladjacente           9 (42.9%)            (100.0%)   (0.0%)   
                       3. Urbano                   6 (28.6%)                                

8    bioma_2014        1. Agropecuária             15 (71.4%)           21         0        
     [character]       2. Floresta                  6 (28.6%)           (100.0%)   (0.0%)   
--------------------------------------------------------------------------------------------

6 característica dos municípios do Sul

bahia_pop_long%>%dplyr::filter(macrorregiao== "Sul")%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, semiarido,IDH,popporte,newtipology,bioma_2014)%>%
   dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,IDH)%>%
  group_by(semiarido)%>%
  unique()%>%
  dfSummary(style='multiline', graph.col = FALSE)
Data Frame Summary  
bahia_pop_long  
Group: semiarido = regiao arida  
Dimensions: 17 x 8  
Duplicates: 0  

--------------------------------------------------------------------------------------------
No   Variable          Stats / Values              Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------- -------------------- ---------- ---------
1    macrorregiao      1. Sul                      17 (100.0%)          17         0        
     [character]                                                        (100.0%)   (0.0%)   

2    regiao.de.saude   1. Jequie                   17 (100.0%)          17         0        
     [character]                                                        (100.0%)   (0.0%)   

3    mun               1. BOA NOVA                 1 ( 5.9%)            17         0        
     [character]       2. BREJOES                  1 ( 5.9%)            (100.0%)   (0.0%)   
                       3. CRAVOLANDIA              1 ( 5.9%)                                
                       4. IRAJUBA                  1 ( 5.9%)                                
                       5. IRAMAIA                  1 ( 5.9%)                                
                       6. ITAGI                    1 ( 5.9%)                                
                       7. ITAQUARA                 1 ( 5.9%)                                
                       8. ITIRUCU                  1 ( 5.9%)                                
                       9. JAGUAQUARA               1 ( 5.9%)                                
                       10. JEQUIE                  1 ( 5.9%)                                
                       [ 7 others ]                7 (41.2%)                                

5    IDH               1. ALTO                      3 (17.6%)           17         0        
     [character]       2. MEDIO                    14 (82.4%)           (100.0%)   (0.0%)   

6    popporte          1. Grande Porte              1 ( 5.9%)           17         0        
     [character]       2. Médio Porte               1 ( 5.9%)           (100.0%)   (0.0%)   
                       3. Pequeno Porte I          14 (82.4%)                               
                       4. Pequeno Porte II          1 ( 5.9%)                               

7    newtipology       1. intermediarioadjacente    4 (23.5%)           17         0        
     [character]       2. ruraladjacente           11 (64.7%)           (100.0%)   (0.0%)   
                       3. Urbano                    2 (11.8%)                               

8    bioma_2014        1. Agropecuária             10 (58.8%)           17         0        
     [character]       2. Floresta                  7 (41.2%)           (100.0%)   (0.0%)   
--------------------------------------------------------------------------------------------

Group: semiarido = regiao nao seca  
Dimensions: 51 x 8  
Duplicates: 0  

--------------------------------------------------------------------------------------------
No   Variable          Stats / Values              Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------- -------------------- ---------- ---------
1    macrorregiao      1. Sul                      51 (100.0%)          51         0        
     [character]                                                        (100.0%)   (0.0%)   

2    regiao.de.saude   1. Ilheus                    8 (15.7%)           51         0        
     [character]       2. Itabuna                  22 (43.1%)           (100.0%)   (0.0%)   
                       3. Jequie                    9 (17.6%)                               
                       4. Valenca                  12 (23.5%)                               

3    mun               1. AIQUARA                   1 ( 2.0%)           51         0        
     [character]       2. ALMADINA                  1 ( 2.0%)           (100.0%)   (0.0%)   
                       3. APUAREMA                  1 ( 2.0%)                               
                       4. ARATACA                   1 ( 2.0%)                               
                       5. AURELINO LEAL             1 ( 2.0%)                               
                       6. BARRA DO ROCHA            1 ( 2.0%)                               
                       7. BARRO PRETO               1 ( 2.0%)                               
                       8. BUERAREMA                 1 ( 2.0%)                               
                       9. CAIRU                     1 ( 2.0%)                               
                       10. CAMACAN                  1 ( 2.0%)                               
                       [ 41 others ]               41 (80.4%)                               

5    IDH               1. ALTO                     11 (21.6%)           51         0        
     [character]       2. MEDIO                    40 (78.4%)           (100.0%)   (0.0%)   

6    popporte          1. Grande Porte              2 ( 3.9%)           51         0        
     [character]       2. Médio Porte               1 ( 2.0%)           (100.0%)   (0.0%)   
                       3. Pequeno Porte I          33 (64.7%)                               
                       4. Pequeno Porte II         15 (29.4%)                               

7    newtipology       1. intermediarioadjacente   16 (31.4%)           51         0        
     [character]       2. ruraladjacente           28 (54.9%)           (100.0%)   (0.0%)   
                       3. Urbano                    7 (13.7%)                               

8    bioma_2014        1. Agropecuária             13 (25.5%)           51         0        
     [character]       2. Floresta                 38 (74.5%)           (100.0%)   (0.0%)   
--------------------------------------------------------------------------------------------

7 característica dos municípios do Centro-Leste

bahia_pop_long%>%dplyr::filter(macrorregiao== "Centro-Leste")%>%
  dplyr::filter(ano==2016)%>%
  dplyr::select(macrorregiao,regiao.de.saude,mun, semiarido,IDH,popporte,newtipology,bioma_2014)%>%
  dplyr::mutate(newtipology = case_when(
                              newtipology== 1 ~ 'intermediarioadjacente',
                              newtipology== 2 ~ 'intermediarioremoto',
                              newtipology== 3 ~ 'ruraladjacente',
                              newtipology== 4 ~ 'ruralremoto',
                              newtipology== 5 ~ 'Urbano'))%>%
  dplyr::mutate(bioma_2014 = case_when(
                              bioma_2014== 1 ~ 'Floresta',
                              bioma_2014== 2 ~ 'Natural não florestal', 
                              bioma_2014== 3 ~ 'Agropecuária', 
                              bioma_2014== 4 ~ 'Area não vegetada',
                              bioma_2014== 5 ~ 'Corpos d’água'))%>%
  dplyr::mutate(semiarido = case_when(
                              semiarido== 0 ~ 'regiao nao seca',
                              semiarido== 1 ~ 'regiao arida'))%>% 
  sort_asc(macrorregiao, regiao.de.saude, mun,semiarido,IDH)%>%
  unique()%>%
  group_by(semiarido)%>%
  dfSummary(style='multiline', graph.col = FALSE)
Data Frame Summary  
bahia_pop_long  
Group: semiarido = regiao arida  
Dimensions: 65 x 8  
Duplicates: 0  

--------------------------------------------------------------------------------------------
No   Variable          Stats / Values              Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------- -------------------- ---------- ---------
1    macrorregiao      1. Centro-Leste             65 (100.0%)          65         0        
     [character]                                                        (100.0%)   (0.0%)   

2    regiao.de.saude   1. Feira de Santana         21 (32.3%)           65         0        
     [character]       2. Itaberaba                14 (21.5%)           (100.0%)   (0.0%)   
                       3. Seabra                   11 (16.9%)                               
                       4. Serrinha                 19 (29.2%)                               

3    mun               1. ABAIRA                    1 ( 1.5%)           65         0        
     [character]       2. AGUA FRIA                 1 ( 1.5%)           (100.0%)   (0.0%)   
                       3. ANDARAI                   1 ( 1.5%)                               
                       4. ANGUERA                   1 ( 1.5%)                               
                       5. ANTONIO CARDOSO           1 ( 1.5%)                               
                       6. ARACI                     1 ( 1.5%)                               
                       7. BAIXA GRANDE              1 ( 1.5%)                               
                       8. BARROCAS                  1 ( 1.5%)                               
                       9. BIRITINGA                 1 ( 1.5%)                               
                       10. BOA VISTA DO TUPIM       1 ( 1.5%)                               
                       [ 55 others ]               55 (84.6%)                               

5    IDH               1. ALTO                     11 (16.9%)           65         0        
     [character]       2. BAIXO                     3 ( 4.6%)           (100.0%)   (0.0%)   
                       3. MEDIO                    51 (78.5%)                               

6    popporte          1. Grande Porte              1 ( 1.5%)           65         0        
     [character]       2. Médio Porte               8 (12.3%)           (100.0%)   (0.0%)   
                       3. Pequeno Porte I          41 (63.1%)                               
                       4. Pequeno Porte II         15 (23.1%)                               

7    newtipology       1. intermediarioadjacente    8 (12.3%)           65         0        
     [character]       2. ruraladjacente           48 (73.8%)           (100.0%)   (0.0%)   
                       3. ruralremoto               5 ( 7.7%)                               
                       4. Urbano                    4 ( 6.2%)                               

8    bioma_2014        1. Agropecuária             45 (69.2%)           65         0        
     [character]       2. Floresta                 20 (30.8%)           (100.0%)   (0.0%)   
--------------------------------------------------------------------------------------------

Group: semiarido = regiao nao seca  
Dimensions: 7 x 8  
Duplicates: 0  

--------------------------------------------------------------------------------------------
No   Variable          Stats / Values              Freqs (% of Valid)   Valid      Missing  
---- ----------------- --------------------------- -------------------- ---------- ---------
1    macrorregiao      1. Centro-Leste             7 (100.0%)           7          0        
     [character]                                                        (100.0%)   (0.0%)   

2    regiao.de.saude   1. Feira de Santana         7 (100.0%)           7          0        
     [character]                                                        (100.0%)   (0.0%)   

3    mun               1. AMELIA RODRIGUES         1 (14.3%)            7          0        
     [character]       2. CONCEICAO DO JACUIPE     1 (14.3%)            (100.0%)   (0.0%)   
                       3. CORACAO DE MARIA         1 (14.3%)                                
                       4. IRARA                    1 (14.3%)                                
                       5. SAO GONCALO DOS CAMPOS   1 (14.3%)                                
                       6. TEODORO SAMPAIO          1 (14.3%)                                
                       7. TERRA NOVA               1 (14.3%)                                

5    IDH               1. ALTO                     3 (42.9%)            7          0        
     [character]       2. MEDIO                    4 (57.1%)            (100.0%)   (0.0%)   

6    popporte          1. Pequeno Porte I          2 (28.6%)            7          0        
     [character]       2. Pequeno Porte II         5 (71.4%)            (100.0%)   (0.0%)   

7    newtipology       1. intermediarioadjacente   2 (28.6%)            7          0        
     [character]       2. ruraladjacente           4 (57.1%)            (100.0%)   (0.0%)   
                       3. Urbano                   1 (14.3%)                                

8    bioma_2014        1. Agropecuária             7 (100.0%)           7          0        
     [character]                                                        (100.0%)   (0.0%)   
--------------------------------------------------------------------------------------------