Trab.Biostat.

##Lendo e vizualizando o arquivo do excel

library(readxl)
world_data_2023 <- read_excel("trabalho bioestatistica_files/world-data-2023.xlsx", 
    col_types = c("text", "text", "numeric", 
        "text", "text", "text", "numeric", 
        "text", "text", "numeric", "numeric", 
        "text", "text", "text", "text", "text", 
        "text", "text", "numeric"))
View(world_data_2023)

##Atribuindo o arquivo à dados e fazendo a tabela dos dados

library(gtsummary)
#Uighur
dados<-(world_data_2023)
tbl_summary(dados)
Characteristic N = 361
País
    Afghanistan 1 (2.8%)
    Angola 1 (2.8%)
    Argentina 1 (2.8%)
    Brazil 1 (2.8%)
    Cambodia 1 (2.8%)
    Canada 1 (2.8%)
    China 1 (2.8%)
    Djibouti 1 (2.8%)
    Egypt 1 (2.8%)
    El Salvador 1 (2.8%)
    Ethiopia 1 (2.8%)
    France 1 (2.8%)
    Germany 1 (2.8%)
    India 1 (2.8%)
    Iran 1 (2.8%)
    Italy 1 (2.8%)
    Japan 1 (2.8%)
    Liechtenstein 1 (2.8%)
    Madagascar 1 (2.8%)
    Mexico 1 (2.8%)
    Mongolia 1 (2.8%)
    Nigeria 1 (2.8%)
    Republic of the Congo 1 (2.8%)
    Russia 1 (2.8%)
    Saudi Arabia 1 (2.8%)
    Senegal 1 (2.8%)
    Slovakia 1 (2.8%)
    South Africa 1 (2.8%)
    Suriname 1 (2.8%)
    Turkey 1 (2.8%)
    United Arab Emirates 1 (2.8%)
    United Kingdom 1 (2.8%)
    United States 1 (2.8%)
    Uruguay 1 (2.8%)
    Venezuela 1 (2.8%)
    Zimbabwe 1 (2.8%)
Taxa Total de Imposto (%)
    106.30 1 (2.8%)
    15.70 1 (2.8%)
    15.90 1 (2.8%)
    21.60 1 (2.8%)
    23.10 1 (2.8%)
    24.50 1 (2.8%)
    25.70 1 (2.8%)
    27.90 1 (2.8%)
    29.20 1 (2.8%)
    30.60 1 (2.8%)
    31.60 1 (2.8%)
    34.80 1 (2.8%)
    36.40 1 (2.8%)
    36.60 1 (2.8%)
    37.70 1 (2.8%)
    37.90 1 (2.8%)
    38.30 1 (2.8%)
    41.80 1 (2.8%)
    42.30 1 (2.8%)
    44.40 1 (2.8%)
    44.70 1 (2.8%)
    44.80 1 (2.8%)
    46.20 1 (2.8%)
    46.70 1 (2.8%)
    48.80 1 (2.8%)
    49.10 1 (2.8%)
    49.70 2 (5.6%)
    54.30 1 (2.8%)
    55.10 1 (2.8%)
    59.10 1 (2.8%)
    59.20 1 (2.8%)
    60.70 1 (2.8%)
    65.10 1 (2.8%)
    71.40 1 (2.8%)
    73.30 1 (2.8%)
Densidade (P/Km2)" 63 (26, 128)
Terras Agrícolas(%)
    0.60 1 (2.8%)
    12.30 1 (2.8%)
    13.30 1 (2.8%)
    24.50 1 (2.8%)
    28.20 1 (2.8%)
    3.80 1 (2.8%)
    30.90 1 (2.8%)
    31.10 1 (2.8%)
    32.20 1 (2.8%)
    33.90 1 (2.8%)
    36.30 1 (2.8%)
    39.20 1 (2.8%)
    41.90 1 (2.8%)
    43.20 1 (2.8%)
    44.40 1 (2.8%)
    46.10 1 (2.8%)
    47.50 1 (2.8%)
    47.70 1 (2.8%)
    49.80 1 (2.8%)
    5.50 1 (2.8%)
    52.40 1 (2.8%)
    54.30 1 (2.8%)
    54.60 1 (2.8%)
    56.20 1 (2.8%)
    58.10 1 (2.8%)
    6.90 1 (2.8%)
    60.40 1 (2.8%)
    71.20 1 (2.8%)
    71.50 1 (2.8%)
    71.70 1 (2.8%)
    73.40 1 (2.8%)
    76.40 1 (2.8%)
    77.70 1 (2.8%)
    79.80 1 (2.8%)
    80.80 1 (2.8%)
    82.60 1 (2.8%)
Land Area(Km2)
    1001450 1 (2.8%)
    1104300 1 (2.8%)
    1219090 1 (2.8%)
    1246700 1 (2.8%)
    1564116 1 (2.8%)
    160 1 (2.8%)
    163.82 1 (2.8%)
    1648195 1 (2.8%)
    17098240 1 (2.8%)
    176215 1 (2.8%)
    181035 1 (2.8%)
    1964375 1 (2.8%)
    196722 1 (2.8%)
    21041 1 (2.8%)
    2149690 1 (2.8%)
    23.2 1 (2.8%)
    243.61 1 (2.8%)
    2780400 1 (2.8%)
    301.34 1 (2.8%)
    3287263 1 (2.8%)
    342 1 (2.8%)
    357022 1 (2.8%)
    377944 1 (2.8%)
    390757 1 (2.8%)
    49035 1 (2.8%)
    587041 1 (2.8%)
    643801 1 (2.8%)
    652.23 1 (2.8%)
    783562 1 (2.8%)
    83.6 1 (2.8%)
    8515770 1 (2.8%)
    912.05 1 (2.8%)
    923768 1 (2.8%)
    9596960 1 (2.8%)
    9833517 1 (2.8%)
    9984670 1 (2.8%)
Taxa de Natalidade
    10.1 1 (2.8%)
    10.33 1 (2.8%)
    10.6 1 (2.8%)
    10.9 1 (2.8%)
    11 1 (2.8%)
    11.3 1 (2.8%)
    11.5 1 (2.8%)
    11.6 1 (2.8%)
    13.86 1 (2.8%)
    13.92 1 (2.8%)
    16.03 1 (2.8%)
    17.02 1 (2.8%)
    17.6 1 (2.8%)
    17.8 1 (2.8%)
    17.86 1 (2.8%)
    17.88 1 (2.8%)
    18.25 1 (2.8%)
    18.54 1 (2.8%)
    18.78 1 (2.8%)
    20.51 1 (2.8%)
    21.47 1 (2.8%)
    22.46 1 (2.8%)
    24.13 1 (2.8%)
    26.38 1 (2.8%)
    30.68 1 (2.8%)
    32.34 1 (2.8%)
    32.49 1 (2.8%)
    32.66 1 (2.8%)
    32.86 1 (2.8%)
    34.52 1 (2.8%)
    37.91 1 (2.8%)
    40.73 1 (2.8%)
    7.3 1 (2.8%)
    7.4 1 (2.8%)
    9.5 1 (2.8%)
    9.9 1 (2.8%)
Emissão de Co2 142,272 (7,068, 479,085)
Taxa de Fertilidade
    1.29 1 (2.8%)
    1.41 1 (2.8%)
    1.42 1 (2.8%)
    1.44 1 (2.8%)
    1.5 1 (2.8%)
    1.52 1 (2.8%)
    1.56 1 (2.8%)
    1.57 1 (2.8%)
    1.68 1 (2.8%)
    1.69 1 (2.8%)
    1.73 2 (5.6%)
    1.88 1 (2.8%)
    1.97 1 (2.8%)
    2.04 1 (2.8%)
    2.07 1 (2.8%)
    2.13 1 (2.8%)
    2.14 1 (2.8%)
    2.22 1 (2.8%)
    2.26 1 (2.8%)
    2.27 1 (2.8%)
    2.32 1 (2.8%)
    2.41 1 (2.8%)
    2.42 1 (2.8%)
    2.5 1 (2.8%)
    2.73 1 (2.8%)
    2.9 1 (2.8%)
    3.33 1 (2.8%)
    3.62 1 (2.8%)
    4.08 1 (2.8%)
    4.25 1 (2.8%)
    4.43 1 (2.8%)
    4.47 1 (2.8%)
    4.63 1 (2.8%)
    5.39 1 (2.8%)
    5.52 1 (2.8%)
Area Florestal(%)
    0.10 1 (2.8%)
    0.20 1 (2.8%)
    0.50 1 (2.8%)
    10.70 1 (2.8%)
    12.50 1 (2.8%)
    12.60 1 (2.8%)
    13.10 1 (2.8%)
    15.40 1 (2.8%)
    2.10 1 (2.8%)
    21.40 1 (2.8%)
    22.40 1 (2.8%)
    23.80 1 (2.8%)
    31.20 1 (2.8%)
    31.80 1 (2.8%)
    32.70 1 (2.8%)
    33.90 2 (5.6%)
    35.50 1 (2.8%)
    38.20 1 (2.8%)
    4.60 1 (2.8%)
    40.40 1 (2.8%)
    42.80 1 (2.8%)
    43.10 1 (2.8%)
    46.30 1 (2.8%)
    49.80 1 (2.8%)
    52.70 1 (2.8%)
    52.90 1 (2.8%)
    58.90 1 (2.8%)
    6.60 1 (2.8%)
    65.40 1 (2.8%)
    68.50 1 (2.8%)
    7.20 1 (2.8%)
    7.60 1 (2.8%)
    8.00 1 (2.8%)
    9.80 1 (2.8%)
    98.30 1 (2.8%)
PIB ($) 433,243,775,031 (26,161,501,013, 1,762,258,732,332)
Matrícula Bruta no Ensino Primário (%) 103 (100, 108)
Expectativa de Vida
    54.3 1 (2.8%)
    60.8 1 (2.8%)
    61.2 1 (2.8%)
    63.9 1 (2.8%)
    64.3 1 (2.8%)
    64.5 1 (2.8%)
    66.2 1 (2.8%)
    66.6 1 (2.8%)
    66.7 1 (2.8%)
    67.7 1 (2.8%)
    69.4 1 (2.8%)
    69.6 1 (2.8%)
    69.7 1 (2.8%)
    71.6 1 (2.8%)
    71.8 1 (2.8%)
    72.1 1 (2.8%)
    72.7 1 (2.8%)
    73.1 1 (2.8%)
    75 2 (5.6%)
    75.7 1 (2.8%)
    76.5 2 (5.6%)
    77 1 (2.8%)
    77.2 1 (2.8%)
    77.4 1 (2.8%)
    77.8 2 (5.6%)
    78.5 1 (2.8%)
    80.9 1 (2.8%)
    81.3 1 (2.8%)
    81.9 1 (2.8%)
    82.5 1 (2.8%)
    82.9 1 (2.8%)
    83 1 (2.8%)
    84.2 1 (2.8%)
Salário Mínimo
    0.01 1 (3.8%)
    0.21 1 (3.8%)
    0.30 1 (3.8%)
    0.31 1 (3.8%)
    0.43 1 (3.8%)
    0.49 1 (3.8%)
    0.50 1 (3.8%)
    0.53 1 (3.8%)
    0.54 1 (3.8%)
    0.65 1 (3.8%)
    0.71 1 (3.8%)
    0.87 1 (3.8%)
    0.88 1 (3.8%)
    1.53 1 (3.8%)
    1.58 1 (3.8%)
    1.66 1 (3.8%)
    10.13 1 (3.8%)
    11.16 1 (3.8%)
    3.11 1 (3.8%)
    3.35 1 (3.8%)
    3.45 1 (3.8%)
    3.85 1 (3.8%)
    6.77 1 (3.8%)
    7.25 1 (3.8%)
    9.51 1 (3.8%)
    9.99 1 (3.8%)
    Unknown 10
Despesas de Saúde do Próprio Bolso
    10.10 1 (2.9%)
    11.10 1 (2.9%)
    12.50 1 (2.9%)
    13.10 1 (2.9%)
    14.60 1 (2.9%)
    14.80 1 (2.9%)
    15.00 1 (2.9%)
    16.20 1 (2.9%)
    16.90 1 (2.9%)
    17.60 1 (2.9%)
    17.80 1 (2.9%)
    18.40 1 (2.9%)
    20.40 1 (2.9%)
    21.70 1 (2.9%)
    22.80 1 (2.9%)
    25.80 1 (2.9%)
    27.90 1 (2.9%)
    28.30 1 (2.9%)
    32.40 1 (2.9%)
    33.40 1 (2.9%)
    36.40 1 (2.9%)
    37.80 1 (2.9%)
    39.30 1 (2.9%)
    39.70 1 (2.9%)
    41.40 1 (2.9%)
    43.80 1 (2.9%)
    44.20 1 (2.9%)
    45.80 1 (2.9%)
    59.40 1 (2.9%)
    6.80 1 (2.9%)
    62.00 1 (2.9%)
    65.10 1 (2.9%)
    7.70 1 (2.9%)
    72.20 1 (2.9%)
    78.40 1 (2.9%)
    Unknown 1
População
    100388073 1 (2.8%)
    112078730 1 (2.8%)
    126014024 1 (2.8%)
    126226568 1 (2.8%)
    1366417754 1 (2.8%)
    1397715000 1 (2.8%)
    144373535 1 (2.8%)
    14645468 1 (2.8%)
    16296364 1 (2.8%)
    16486542 1 (2.8%)
    200963599 1 (2.8%)
    212559417 1 (2.8%)
    26969307 1 (2.8%)
    28515829 1 (2.8%)
    31825295 1 (2.8%)
    3225167 1 (2.8%)
    328239523 1 (2.8%)
    34268528 1 (2.8%)
    3461734 1 (2.8%)
    36991981 1 (2.8%)
    38019 1 (2.8%)
    38041754 1 (2.8%)
    44938712 1 (2.8%)
    5380508 1 (2.8%)
    5454073 1 (2.8%)
    581372 1 (2.8%)
    58558270 1 (2.8%)
    60297396 1 (2.8%)
    6453553 1 (2.8%)
    66834405 1 (2.8%)
    67059887 1 (2.8%)
    82913906 1 (2.8%)
    83132799 1 (2.8%)
    83429615 1 (2.8%)
    973.56 1 (2.8%)
    9770529 1 (2.8%)
Taxa de Desemprego
    0.68 1 (2.9%)
    1.76 1 (2.9%)
    10.30 1 (2.9%)
    10.76 1 (2.9%)
    11.12 1 (2.9%)
    11.38 1 (2.9%)
    12.08 1 (2.9%)
    13.49 1 (2.9%)
    14.70 1 (2.9%)
    2.08 1 (2.9%)
    2.29 1 (2.9%)
    2.35 1 (2.9%)
    28.18 1 (2.9%)
    3.04 1 (2.9%)
    3.42 1 (2.9%)
    3.85 1 (2.9%)
    4.11 1 (2.9%)
    4.32 1 (2.9%)
    4.59 1 (2.9%)
    4.95 1 (2.9%)
    5.36 1 (2.9%)
    5.56 2 (5.7%)
    5.93 1 (2.9%)
    6.01 1 (2.9%)
    6.60 1 (2.9%)
    6.89 1 (2.9%)
    7.33 1 (2.9%)
    8.10 1 (2.9%)
    8.43 1 (2.9%)
    8.73 1 (2.9%)
    8.80 1 (2.9%)
    9.47 1 (2.9%)
    9.79 1 (2.9%)
    9.89 1 (2.9%)
    Unknown 1
População Urbana
    10210849 1 (2.8%)
    102626859 1 (2.8%)
    102806948 1 (2.8%)
    107683889 1 (2.8%)
    115782416 1 (2.8%)
    183241641 1 (2.8%)
    21061025 1 (2.8%)
    2210626 1 (2.8%)
    23788710 1 (2.8%)
    25162368 1 (2.8%)
    270663028 1 (2.8%)
    28807838 1 (2.8%)
    2930419 1 (2.8%)
    30628482 1 (2.8%)
    3303394 1 (2.8%)
    3625010 1 (2.8%)
    384258 1 (2.8%)
    39149717 1 (2.8%)
    3924621 1 (2.8%)
    41339571 1 (2.8%)
    42651966 1 (2.8%)
    42895824 1 (2.8%)
    4694702 1 (2.8%)
    471031528 1 (2.8%)
    4717305 1 (2.8%)
    54123364 1 (2.8%)
    5464 1 (2.8%)
    55908316 1 (2.8%)
    62509623 1 (2.8%)
    63097818 1 (2.8%)
    64324835 1 (2.8%)
    758549 1 (2.8%)
    7765706 1 (2.8%)
    842933962 1 (2.8%)
    8479744 1 (2.8%)
    9797273 1 (2.8%)
Gross primary education enrollment (%)
    100.20 1 (2.8%)
    100.90 2 (5.6%)
    101.00 1 (2.8%)
    101.20 1 (2.8%)
    101.80 1 (2.8%)
    101.90 1 (2.8%)
    102.50 1 (2.8%)
    102.60 1 (2.8%)
    104.00 3 (8.3%)
    104.70 1 (2.8%)
    105.80 1 (2.8%)
    106.30 1 (2.8%)
    106.60 1 (2.8%)
    107.40 1 (2.8%)
    108.40 1 (2.8%)
    108.50 1 (2.8%)
    108.80 1 (2.8%)
    109.70 1 (2.8%)
    109.90 1 (2.8%)
    110.70 1 (2.8%)
    113.00 1 (2.8%)
    113.50 1 (2.8%)
    115.40 1 (2.8%)
    142.50 1 (2.8%)
    75.30 1 (2.8%)
    81.00 1 (2.8%)
    84.70 1 (2.8%)
    93.20 1 (2.8%)
    94.80 1 (2.8%)
    97.20 1 (2.8%)
    98.70 1 (2.8%)
    98.80 1 (2.8%)
    99.80 1 (2.8%)
Infant mortality 12 (6, 31)
    Unknown 1
1 n (%); Median (IQR)

##Apagando variáveis em excesso

library(dados)
dados<- world_data_2023
dados$Latitude<-NULL
dados$Longitude<-NULL
dados$`Tax revenue (%)`<-NULL
dados$`Physicians per thousand`<-NULL
dados$`Armed Forces size`<-NULL
dados$`Capital/Major City`<-NULL
dados$`Currency-Code`<-NULL
dados$`Gasoline Price`<-NULL
dados$`Official language`<-NULL
dados$`Calling Code`<-NULL #não sei o que é isso
dados$`<-`<-NULL #não sei o que é isso
dados$`Gross tertiary education enrollment (%)`<- NULL
dados$`Maternal mortality ratio`<- NULL
dados$CPI<- NULL
dados$`CPI Change (%)`<-NULL
dados$`Largest city`<- NULL
dados$`Terras Agrícolas(%)`<-NULL
dados$`Land Area(Km2)`<-NULL
dados$População<-NULL
dados$`População Urbana`<-NULL
dados$`Taxa de Desemprego`<-NULL
dados$`Densidade (P/Km2)"`<-NULL
dados$`Taxa de Natalidade`<-NULL

#Fazendo uma nova tabela, agora sem as variáveis em excesso

library(gtsummary)
dados<-(dados)
tbl_summary(dados)
Characteristic N = 361
País
    Afghanistan 1 (2.8%)
    Angola 1 (2.8%)
    Argentina 1 (2.8%)
    Brazil 1 (2.8%)
    Cambodia 1 (2.8%)
    Canada 1 (2.8%)
    China 1 (2.8%)
    Djibouti 1 (2.8%)
    Egypt 1 (2.8%)
    El Salvador 1 (2.8%)
    Ethiopia 1 (2.8%)
    France 1 (2.8%)
    Germany 1 (2.8%)
    India 1 (2.8%)
    Iran 1 (2.8%)
    Italy 1 (2.8%)
    Japan 1 (2.8%)
    Liechtenstein 1 (2.8%)
    Madagascar 1 (2.8%)
    Mexico 1 (2.8%)
    Mongolia 1 (2.8%)
    Nigeria 1 (2.8%)
    Republic of the Congo 1 (2.8%)
    Russia 1 (2.8%)
    Saudi Arabia 1 (2.8%)
    Senegal 1 (2.8%)
    Slovakia 1 (2.8%)
    South Africa 1 (2.8%)
    Suriname 1 (2.8%)
    Turkey 1 (2.8%)
    United Arab Emirates 1 (2.8%)
    United Kingdom 1 (2.8%)
    United States 1 (2.8%)
    Uruguay 1 (2.8%)
    Venezuela 1 (2.8%)
    Zimbabwe 1 (2.8%)
Taxa Total de Imposto (%)
    106.30 1 (2.8%)
    15.70 1 (2.8%)
    15.90 1 (2.8%)
    21.60 1 (2.8%)
    23.10 1 (2.8%)
    24.50 1 (2.8%)
    25.70 1 (2.8%)
    27.90 1 (2.8%)
    29.20 1 (2.8%)
    30.60 1 (2.8%)
    31.60 1 (2.8%)
    34.80 1 (2.8%)
    36.40 1 (2.8%)
    36.60 1 (2.8%)
    37.70 1 (2.8%)
    37.90 1 (2.8%)
    38.30 1 (2.8%)
    41.80 1 (2.8%)
    42.30 1 (2.8%)
    44.40 1 (2.8%)
    44.70 1 (2.8%)
    44.80 1 (2.8%)
    46.20 1 (2.8%)
    46.70 1 (2.8%)
    48.80 1 (2.8%)
    49.10 1 (2.8%)
    49.70 2 (5.6%)
    54.30 1 (2.8%)
    55.10 1 (2.8%)
    59.10 1 (2.8%)
    59.20 1 (2.8%)
    60.70 1 (2.8%)
    65.10 1 (2.8%)
    71.40 1 (2.8%)
    73.30 1 (2.8%)
Emissão de Co2 142,272 (7,068, 479,085)
Taxa de Fertilidade
    1.29 1 (2.8%)
    1.41 1 (2.8%)
    1.42 1 (2.8%)
    1.44 1 (2.8%)
    1.5 1 (2.8%)
    1.52 1 (2.8%)
    1.56 1 (2.8%)
    1.57 1 (2.8%)
    1.68 1 (2.8%)
    1.69 1 (2.8%)
    1.73 2 (5.6%)
    1.88 1 (2.8%)
    1.97 1 (2.8%)
    2.04 1 (2.8%)
    2.07 1 (2.8%)
    2.13 1 (2.8%)
    2.14 1 (2.8%)
    2.22 1 (2.8%)
    2.26 1 (2.8%)
    2.27 1 (2.8%)
    2.32 1 (2.8%)
    2.41 1 (2.8%)
    2.42 1 (2.8%)
    2.5 1 (2.8%)
    2.73 1 (2.8%)
    2.9 1 (2.8%)
    3.33 1 (2.8%)
    3.62 1 (2.8%)
    4.08 1 (2.8%)
    4.25 1 (2.8%)
    4.43 1 (2.8%)
    4.47 1 (2.8%)
    4.63 1 (2.8%)
    5.39 1 (2.8%)
    5.52 1 (2.8%)
Area Florestal(%)
    0.10 1 (2.8%)
    0.20 1 (2.8%)
    0.50 1 (2.8%)
    10.70 1 (2.8%)
    12.50 1 (2.8%)
    12.60 1 (2.8%)
    13.10 1 (2.8%)
    15.40 1 (2.8%)
    2.10 1 (2.8%)
    21.40 1 (2.8%)
    22.40 1 (2.8%)
    23.80 1 (2.8%)
    31.20 1 (2.8%)
    31.80 1 (2.8%)
    32.70 1 (2.8%)
    33.90 2 (5.6%)
    35.50 1 (2.8%)
    38.20 1 (2.8%)
    4.60 1 (2.8%)
    40.40 1 (2.8%)
    42.80 1 (2.8%)
    43.10 1 (2.8%)
    46.30 1 (2.8%)
    49.80 1 (2.8%)
    52.70 1 (2.8%)
    52.90 1 (2.8%)
    58.90 1 (2.8%)
    6.60 1 (2.8%)
    65.40 1 (2.8%)
    68.50 1 (2.8%)
    7.20 1 (2.8%)
    7.60 1 (2.8%)
    8.00 1 (2.8%)
    9.80 1 (2.8%)
    98.30 1 (2.8%)
PIB ($) 433,243,775,031 (26,161,501,013, 1,762,258,732,332)
Matrícula Bruta no Ensino Primário (%) 103 (100, 108)
Expectativa de Vida
    54.3 1 (2.8%)
    60.8 1 (2.8%)
    61.2 1 (2.8%)
    63.9 1 (2.8%)
    64.3 1 (2.8%)
    64.5 1 (2.8%)
    66.2 1 (2.8%)
    66.6 1 (2.8%)
    66.7 1 (2.8%)
    67.7 1 (2.8%)
    69.4 1 (2.8%)
    69.6 1 (2.8%)
    69.7 1 (2.8%)
    71.6 1 (2.8%)
    71.8 1 (2.8%)
    72.1 1 (2.8%)
    72.7 1 (2.8%)
    73.1 1 (2.8%)
    75 2 (5.6%)
    75.7 1 (2.8%)
    76.5 2 (5.6%)
    77 1 (2.8%)
    77.2 1 (2.8%)
    77.4 1 (2.8%)
    77.8 2 (5.6%)
    78.5 1 (2.8%)
    80.9 1 (2.8%)
    81.3 1 (2.8%)
    81.9 1 (2.8%)
    82.5 1 (2.8%)
    82.9 1 (2.8%)
    83 1 (2.8%)
    84.2 1 (2.8%)
Salário Mínimo
    0.01 1 (3.8%)
    0.21 1 (3.8%)
    0.30 1 (3.8%)
    0.31 1 (3.8%)
    0.43 1 (3.8%)
    0.49 1 (3.8%)
    0.50 1 (3.8%)
    0.53 1 (3.8%)
    0.54 1 (3.8%)
    0.65 1 (3.8%)
    0.71 1 (3.8%)
    0.87 1 (3.8%)
    0.88 1 (3.8%)
    1.53 1 (3.8%)
    1.58 1 (3.8%)
    1.66 1 (3.8%)
    10.13 1 (3.8%)
    11.16 1 (3.8%)
    3.11 1 (3.8%)
    3.35 1 (3.8%)
    3.45 1 (3.8%)
    3.85 1 (3.8%)
    6.77 1 (3.8%)
    7.25 1 (3.8%)
    9.51 1 (3.8%)
    9.99 1 (3.8%)
    Unknown 10
Despesas de Saúde do Próprio Bolso
    10.10 1 (2.9%)
    11.10 1 (2.9%)
    12.50 1 (2.9%)
    13.10 1 (2.9%)
    14.60 1 (2.9%)
    14.80 1 (2.9%)
    15.00 1 (2.9%)
    16.20 1 (2.9%)
    16.90 1 (2.9%)
    17.60 1 (2.9%)
    17.80 1 (2.9%)
    18.40 1 (2.9%)
    20.40 1 (2.9%)
    21.70 1 (2.9%)
    22.80 1 (2.9%)
    25.80 1 (2.9%)
    27.90 1 (2.9%)
    28.30 1 (2.9%)
    32.40 1 (2.9%)
    33.40 1 (2.9%)
    36.40 1 (2.9%)
    37.80 1 (2.9%)
    39.30 1 (2.9%)
    39.70 1 (2.9%)
    41.40 1 (2.9%)
    43.80 1 (2.9%)
    44.20 1 (2.9%)
    45.80 1 (2.9%)
    59.40 1 (2.9%)
    6.80 1 (2.9%)
    62.00 1 (2.9%)
    65.10 1 (2.9%)
    7.70 1 (2.9%)
    72.20 1 (2.9%)
    78.40 1 (2.9%)
    Unknown 1
Gross primary education enrollment (%)
    100.20 1 (2.8%)
    100.90 2 (5.6%)
    101.00 1 (2.8%)
    101.20 1 (2.8%)
    101.80 1 (2.8%)
    101.90 1 (2.8%)
    102.50 1 (2.8%)
    102.60 1 (2.8%)
    104.00 3 (8.3%)
    104.70 1 (2.8%)
    105.80 1 (2.8%)
    106.30 1 (2.8%)
    106.60 1 (2.8%)
    107.40 1 (2.8%)
    108.40 1 (2.8%)
    108.50 1 (2.8%)
    108.80 1 (2.8%)
    109.70 1 (2.8%)
    109.90 1 (2.8%)
    110.70 1 (2.8%)
    113.00 1 (2.8%)
    113.50 1 (2.8%)
    115.40 1 (2.8%)
    142.50 1 (2.8%)
    75.30 1 (2.8%)
    81.00 1 (2.8%)
    84.70 1 (2.8%)
    93.20 1 (2.8%)
    94.80 1 (2.8%)
    97.20 1 (2.8%)
    98.70 1 (2.8%)
    98.80 1 (2.8%)
    99.80 1 (2.8%)
Infant mortality 12 (6, 31)
    Unknown 1
1 n (%); Median (IQR)

##Vendo a estrutura dos dados

str(dados)
tibble [36 × 12] (S3: tbl_df/tbl/data.frame)
 $ País                                  : chr [1:36] "Saudi Arabia" "Mongolia" "China" "Madagascar" ...
 $ Taxa Total de Imposto (%)             : chr [1:36] "15.70" "25.70" "59.20" "38.30" ...
 $ Emissão de Co2                        : num [1:36] 563449 486406 9893038 51 120369 ...
 $ Taxa de Fertilidade                   : chr [1:36] "2.32" "2.13" "1.69" "1.44" ...
 $ Area Florestal(%)                     : chr [1:36] "0.50" "33.90" "22.40" "43.10" ...
 $ PIB ($)                               : num [1:36] 7.93e+11 1.26e+12 1.99e+13 6.55e+09 4.48e+11 ...
 $ Matrícula Bruta no Ensino Primário (%): num [1:36] 99.8 105.8 100.2 104.7 84.7 ...
 $ Expectativa de Vida                   : chr [1:36] "75" "75" "77" "83" ...
 $ Salário Mínimo                        : chr [1:36] "1.66" "3.11" "0.88" "3.85" ...
 $ Despesas de Saúde do Próprio Bolso    : chr [1:36] "44.20" "39.30" "32.40" "21.70" ...
 $ Gross primary education enrollment (%): chr [1:36] "99.80" "104.00" "100.20" "142.50" ...
 $ Infant mortality                      : num [1:36] 6 14 7.4 38.2 36.2 51.6 33.9 28.5 49.8 47.9 ...

##Traduzindo o nome de variáveis

colnames(dados)
 [1] "País"                                  
 [2] "Taxa Total de Imposto (%)"             
 [3] "Emissão de Co2"                        
 [4] "Taxa de Fertilidade"                   
 [5] "Area Florestal(%)"                     
 [6] "PIB ($)"                               
 [7] "Matrícula Bruta no Ensino Primário (%)"
 [8] "Expectativa de Vida"                   
 [9] "Salário Mínimo"                        
[10] "Despesas de Saúde do Próprio Bolso"    
[11] "Gross primary education enrollment (%)"
[12] "Infant mortality"                      
colnames(dados)[10]<-"PIB"
colnames(dados)[18]<-"Matrícula Bruta no Ensino Primário"
colnames(dados)[19]<-"Mortalidade Infantil"

##Precisamos de no mínimo 2 variáveis quali e 2 quanti; vamos transformar uma quanti em quali através da criação de uma faixa de valores:

#Transformar PIB em qualitativa:

dados$PIB<-cut(dados$`PIB ($)`,c(0,3318716360,5354435962732,10712190641821,16069945320911,214277000000000))
levels(dados$`PIB ($)`)<-c("De 0 a 3318716360", "De 3318716360 a 5354435962732", "De 10712190641821 a 16069945320911","De 16069945320911 a 21427700000000 ", "Mais de 21427700000000")

#Transformar EMISSÃO DE CARBONO em qualitativa:

# world_data_2023$`Emissão de Co2`<-cut(world_data_2023$`Emissão de Co2`,c(0,1738,2471957,4945651,7419345,9893038))
# world_data_2023$`Emissão de Co2`

world_data_2023$`Emissão de Co2`
levels(world_data_2023$`Emissão de Co2`)<-c("De 0 a 1738", "De 1738 a 2471957", "De 4945651 a 7419345","De 7419345 a 9893038", "Mais de 9893038")

#Transformar MORTALIDADE INFANTIL em qualitativa:

# world_data_2023$`Infant mortality`<-cut(world_data_2023$`Infant mortality`,c(0,40,60,2000)) 

world_data_2023$`Infant mortality` 

levels(world_data_2023$`Infant mortality`)<-c("Até 40 mortes", "Mais que 40 mortes e até 60 mortes", "Mais que 60 mortes")

Perguntas e seus respctivos gráficos:

Criando o Gráfico com o uso de duas qualitativas:

O quanto o PIB aumenta de acordo com a quantidade de emissão de CO2?

str(world_data_2023)
tibble [36 × 19] (S3: tbl_df/tbl/data.frame)
 $ País                                  : chr [1:36] "Saudi Arabia" "Mongolia" "China" "Madagascar" ...
 $ Taxa Total de Imposto (%)             : chr [1:36] "15.70" "25.70" "59.20" "38.30" ...
 $ Densidade (P/Km2)"                    : num [1:36] 16 66 153 238 226 26 38 49 16 60 ...
 $ Terras Agrícolas(%)                   : chr [1:36] "80.80" "54.60" "56.20" "32.20" ...
 $ Land Area(Km2)                        : chr [1:36] "2149690" "1964375" "9596960" "160" ...
 $ Taxa de Natalidade                    : chr [1:36] "17.8" "17.6" "10.9" "9.9" ...
 $ Emissão de Co2                        : num [1:36] 563449 486406 9893038 51 120369 ...
  ..- attr(*, "levels")= chr [1:5] "De 0 a 1738" "De 1738 a 2471957" "De 4945651 a 7419345" "De 7419345 a 9893038" ...
 $ Taxa de Fertilidade                   : chr [1:36] "2.32" "2.13" "1.69" "1.44" ...
 $ Area Florestal(%)                     : chr [1:36] "0.50" "33.90" "22.40" "43.10" ...
 $ PIB ($)                               : num [1:36] 7.93e+11 1.26e+12 1.99e+13 6.55e+09 4.48e+11 ...
 $ Matrícula Bruta no Ensino Primário (%): num [1:36] 99.8 105.8 100.2 104.7 84.7 ...
 $ Expectativa de Vida                   : chr [1:36] "75" "75" "77" "83" ...
 $ Salário Mínimo                        : chr [1:36] "1.66" "3.11" "0.88" "3.85" ...
 $ Despesas de Saúde do Próprio Bolso    : chr [1:36] "44.20" "39.30" "32.40" "21.70" ...
 $ População                             : chr [1:36] "34268528" "126014024" "1397715000" "38019" ...
 $ Taxa de Desemprego                    : chr [1:36] "6.60" "6.01" "4.32" "1.76" ...
 $ População Urbana                      : chr [1:36] "28807838" "102626859" "842933962" "5464" ...
 $ Gross primary education enrollment (%): chr [1:36] "99.80" "104.00" "100.20" "142.50" ...
 $ Infant mortality                      : num [1:36] 6 14 7.4 38.2 36.2 51.6 33.9 28.5 49.8 47.9 ...
  ..- attr(*, "levels")= chr [1:3] "Até 40 mortes" "Mais que 40 mortes e até 60 mortes" "Mais que 60 mortes"
library(ggplot2)

ggplot(world_data_2023) +
 aes(x = `Emissão de Co2`, y = `PIB ($)`) +
 geom_tile() +
 labs(x = " Emissões de dióxido de carbono em toneladas", 
 y = "PIB, valor total dos bens e serviços produzidos no país", title = "Emissão de C02 em relação ao PIB", 
 subtitle = "Um panorama global") +
 theme_minimal() +
 theme(plot.title = element_text(face = "bold", 
 hjust = 0.5), plot.subtitle = element_text(size = 13L, face = "italic", hjust = 0.5))

Criando o Gráfico com o uso de duas quantitativas:

A presença de maior área florestal aumenta a expectativa de vida da população?

library(readxl)
expect_vida <- read_excel("trabalho bioestatistica_files/expect_vida.xlsx", 
    col_types = c("text", "numeric", "numeric"))
Warning: Coercing text to numeric in B2 / R2C2: '0.50'
Warning: Coercing text to numeric in B3 / R3C2: '33.90'
Warning: Coercing text to numeric in B4 / R4C2: '22.40'
Warning: Coercing text to numeric in B5 / R5C2: '43.10'
Warning: Coercing text to numeric in B6 / R6C2: '7.20'
Warning: Coercing text to numeric in C6 / R6C3: '54.3'
Warning: Coercing text to numeric in B7 / R7C2: '46.30'
Warning: Coercing text to numeric in C7 / R7C3: '60.8'
Warning: Coercing text to numeric in B8 / R8C2: '35.50'
Warning: Coercing text to numeric in C8 / R8C3: '61.2'
Warning: Coercing text to numeric in B9 / R9C2: '7.60'
Warning: Coercing text to numeric in C9 / R9C3: '63.9'
Warning: Coercing text to numeric in B10 / R10C2: '65.40'
Warning: Coercing text to numeric in C10 / R10C3: '64.3'
Warning: Coercing text to numeric in B11 / R11C2: '2.10'
Warning: Coercing text to numeric in C11 / R11C3: '64.5'
Warning: Coercing text to numeric in B12 / R12C2: '12.50'
Warning: Coercing text to numeric in C12 / R12C3: '66.2'
Warning: Coercing text to numeric in B13 / R13C2: '0.20'
Warning: Coercing text to numeric in C13 / R13C3: '66.6'
Warning: Coercing text to numeric in B14 / R14C2: '21.40'
Warning: Coercing text to numeric in C14 / R14C3: '66.7'
Warning: Coercing text to numeric in B15 / R15C2: '42.80'
Warning: Coercing text to numeric in C15 / R15C3: '67.7'
Warning: Coercing text to numeric in B16 / R16C2: '23.80'
Warning: Coercing text to numeric in C16 / R16C3: '69.4'
Warning: Coercing text to numeric in B17 / R17C2: '52.90'
Warning: Coercing text to numeric in C17 / R17C3: '69.6'
Warning: Coercing text to numeric in B18 / R18C2: '8.00'
Warning: Coercing text to numeric in C18 / R18C3: '69.7'
Warning: Coercing text to numeric in B19 / R19C2: '98.30'
Warning: Coercing text to numeric in C19 / R19C3: '71.6'
Warning: Coercing text to numeric in B20 / R20C2: '0.10'
Warning: Coercing text to numeric in C20 / R20C3: '71.8'
Warning: Coercing text to numeric in B21 / R21C2: '52.70'
Warning: Coercing text to numeric in C21 / R21C3: '72.1'
Warning: Coercing text to numeric in B22 / R22C2: '49.80'
Warning: Coercing text to numeric in C22 / R22C3: '72.7'
Warning: Coercing text to numeric in B23 / R23C2: '12.60'
Warning: Coercing text to numeric in C23 / R23C3: '73.1'
Warning: Coercing text to numeric in B24 / R24C2: '58.90'
Warning: Coercing text to numeric in C24 / R24C3: '75.7'
Warning: Coercing text to numeric in B25 / R25C2: '9.80'
Warning: Coercing text to numeric in C25 / R25C3: '76.5'
Warning: Coercing text to numeric in B26 / R26C2: '6.60'
Warning: Coercing text to numeric in C26 / R26C3: '76.5'
Warning: Coercing text to numeric in B27 / R27C2: '40.40'
Warning: Coercing text to numeric in C27 / R27C3: '77.2'
Warning: Coercing text to numeric in B28 / R28C2: '15.40'
Warning: Coercing text to numeric in C28 / R28C3: '77.4'
Warning: Coercing text to numeric in B29 / R29C2: '10.70'
Warning: Coercing text to numeric in C29 / R29C3: '77.8'
Warning: Coercing text to numeric in B30 / R30C2: '4.60'
Warning: Coercing text to numeric in C30 / R30C3: '77.8'
Warning: Coercing text to numeric in B31 / R31C2: '33.90'
Warning: Coercing text to numeric in C31 / R31C3: '78.5'
Warning: Coercing text to numeric in B32 / R32C2: '32.70'
Warning: Coercing text to numeric in C32 / R32C3: '80.9'
Warning: Coercing text to numeric in B33 / R33C2: '13.10'
Warning: Coercing text to numeric in C33 / R33C3: '81.3'
Warning: Coercing text to numeric in B34 / R34C2: '38.20'
Warning: Coercing text to numeric in C34 / R34C3: '81.9'
Warning: Coercing text to numeric in B35 / R35C2: '31.20'
Warning: Coercing text to numeric in C35 / R35C3: '82.5'
Warning: Coercing text to numeric in B36 / R36C2: '31.80'
Warning: Coercing text to numeric in C36 / R36C3: '82.9'
Warning: Coercing text to numeric in B37 / R37C2: '68.50'
Warning: Coercing text to numeric in C37 / R37C3: '84.2'
View(expect_vida)


library(ggplot2)

ggplot(expect_vida) +
 aes(x = `Area Florestal(%)`, y = `Expectativa de Vida`) +
 geom_point(shape = "circle", 
 size = 1.5, colour = "#112446") +
 labs(x = "Área Florestal (%): Porcentagem de área coberta por florestas", 
 y = "Número médio de anos que se espera que um recém-nascido viva", title = "Expectativa de Vida relacionada à Área Florestal", 
 subtitle = "Um panorama global") +
 theme_minimal()

Criando o Gráfico com o uso de uma qualitativa e uma quantitativa:

Países com mais matrículas no ensino primário tem menor mortalidade infantil?

library(readxl)
mort_matri <- read_excel("trabalho bioestatistica_files/mort_matri.xlsx", 
    col_types = c("text", "numeric", "numeric"))
Warning: Coercing text to numeric in B2 / R2C2: '99.80'
Warning: Coercing text to numeric in B3 / R3C2: '105.80'
Warning: Coercing text to numeric in B4 / R4C2: '100.20'
Warning: Coercing text to numeric in C4 / R4C3: '7.4'
Warning: Coercing text to numeric in B5 / R5C2: '104.70'
Warning: Coercing text to numeric in C5 / R5C3: '38.2'
Warning: Coercing text to numeric in B6 / R6C2: '84.70'
Warning: Coercing text to numeric in C6 / R6C3: '36.2'
Warning: Coercing text to numeric in B7 / R7C2: '113.50'
Warning: Coercing text to numeric in C7 / R7C3: '51.6'
Warning: Coercing text to numeric in B8 / R8C2: '109.90'
Warning: Coercing text to numeric in C8 / R8C3: '33.9'
Warning: Coercing text to numeric in B9 / R9C2: '100.90'
Warning: Coercing text to numeric in C9 / R9C3: '28.5'
Warning: Coercing text to numeric in B10 / R10C2: '106.60'
Warning: Coercing text to numeric in C10 / R10C3: '49.8'
Warning: Coercing text to numeric in B11 / R11C2: '104.00'
Warning: Coercing text to numeric in C11 / R11C3: '47.9'
Warning: Coercing text to numeric in B12 / R12C2: '101.00'
Warning: Coercing text to numeric in C12 / R12C3: '3.4'
Warning: Coercing text to numeric in B13 / R13C2: '75.30'
Warning: Coercing text to numeric in C13 / R13C3: '18.1'
Warning: Coercing text to numeric in B14 / R14C2: '142.50'
Warning: Coercing text to numeric in B15 / R15C2: '81.00'
Warning: Coercing text to numeric in C15 / R15C3: '31.8'
Warning: Coercing text to numeric in B16 / R16C2: '113.00'
Warning: Coercing text to numeric in C16 / R16C3: '12.4'
Warning: Coercing text to numeric in B17 / R17C2: '107.40'
Warning: Coercing text to numeric in B18 / R18C2: '104.00'
Warning: Coercing text to numeric in C18 / R18C3: '75.7'
Warning: Coercing text to numeric in B19 / R19C2: '108.80'
Warning: Coercing text to numeric in C19 / R19C3: '16.9'
Warning: Coercing text to numeric in B20 / R20C2: '106.30'
Warning: Coercing text to numeric in C20 / R20C3: '11.8'
Warning: Coercing text to numeric in B21 / R21C2: '97.20'
Warning: Coercing text to numeric in C21 / R21C3: '21.4'
Warning: Coercing text to numeric in B22 / R22C2: '102.60'
Warning: Coercing text to numeric in C22 / R22C3: '6.1'
Warning: Coercing text to numeric in B23 / R23C2: '94.80'
Warning: Coercing text to numeric in C23 / R23C3: '39.1'
Warning: Coercing text to numeric in B24 / R24C2: '115.40'
Warning: Coercing text to numeric in C24 / R24C3: '12.8'
Warning: Coercing text to numeric in B25 / R25C2: '109.70'
Warning: Coercing text to numeric in C25 / R25C3: '8.8'
Warning: Coercing text to numeric in B26 / R26C2: '110.70'
Warning: Coercing text to numeric in C26 / R26C3: '2.6'
Warning: Coercing text to numeric in B27 / R27C2: '98.70'
Warning: Coercing text to numeric in C27 / R27C3: '4.6'
Warning: Coercing text to numeric in B28 / R28C2: '93.20'
Warning: Coercing text to numeric in C28 / R28C3: '9.1'
Warning: Coercing text to numeric in B29 / R29C2: '108.50'
Warning: Coercing text to numeric in C29 / R29C3: '6.4'
Warning: Coercing text to numeric in B30 / R30C2: '108.40'
Warning: Coercing text to numeric in C30 / R30C3: '6.5'
Warning: Coercing text to numeric in B31 / R31C2: '101.80'
Warning: Coercing text to numeric in C31 / R31C3: '5.6'
Warning: Coercing text to numeric in B32 / R32C2: '104.00'
Warning: Coercing text to numeric in C32 / R32C3: '29.9'
Warning: Coercing text to numeric in B33 / R33C2: '101.20'
Warning: Coercing text to numeric in C33 / R33C3: '3.6'
Warning: Coercing text to numeric in B34 / R34C2: '100.90'
Warning: Coercing text to numeric in C34 / R34C3: '4.3'
Warning: Coercing text to numeric in B35 / R35C2: '102.50'
Warning: Coercing text to numeric in C35 / R35C3: '3.1'
Warning: Coercing text to numeric in B36 / R36C2: '101.90'
Warning: Coercing text to numeric in C36 / R36C3: '1.8'
Warning: Coercing text to numeric in B37 / R37C2: '98.80'
View(mort_matri)

mort_matri$`Infant mortality`<-cut(mort_matri$`Infant mortality`,c(0,40,60,2000)) 

mort_matri$`Infant mortality` 
 [1] (0,40]     (0,40]     (0,40]     (0,40]     (0,40]     (40,60]   
 [7] (0,40]     (0,40]     (40,60]    (40,60]    (0,40]     (0,40]    
[13] (0,40]     (0,40]     (0,40]     (0,40]     (60,2e+03] (0,40]    
[19] (0,40]     (0,40]     (0,40]     (0,40]     (0,40]     (0,40]    
[25] (0,40]     (0,40]     (0,40]     (0,40]     (0,40]     (0,40]    
[31] (0,40]     (0,40]     (0,40]     (0,40]     (0,40]     <NA>      
Levels: (0,40] (40,60] (60,2e+03]
levels(mort_matri$`Infant mortality`)<-c("Até 40 mortes", "Mais que 40 mortes e até 60 mortes", "Mais que 60 mortes")


library(dplyr)

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(ggplot2)

mort_matri %>%
 filter(`Matrícula Bruta no Ensino Primário (%)` >= 75 & `Matrícula Bruta no Ensino Primário (%)` <= 
 120.5) %>%
 filter(!is.na(`Infant mortality`)) %>%
 ggplot() +
 aes(x = `Matrícula Bruta no Ensino Primário (%)`, y = `Infant mortality`) +
 geom_boxplot(fill = "#112446") +
 labs(x = "Taxa bruta de matrícula no ensino primário (%)", y = "Mortalidade Infantil: Número de mortes por 1.000 nascidos vivos antes de completar um ano de idade", 
 title = "Mortalidade Infantil e a percentagem de matriculados no Ensino Primário", subtitle = "Um panorama global") +
 coord_flip() +
 theme_minimal() +
 theme(plot.title = element_text(face = "bold", hjust = 0.5), plot.subtitle = element_text(size = 13L, 
 face = "italic", hjust = 0.5))