0.- Carga de librerias

library(readr)
library(dplyr)
library(knitr)
library(kableExtra)
library(ggplot2)

1.- Leer datos

setwd("C:/Users/CESAR/Downloads/proyecto x")
variables <- read.csv("C:/Users/CESAR/Downloads/proyecto x/GlobalweatherRepository.csv", header = TRUE)

2.- Depuración y selección de la variable

Depuración

variables <- na.omit(variables)

Selección

Pais <- variables$country

3.- Frecuencias

Tabla 1

Tabla_Pais <- table(Pais)
ni_pais <- as.vector(Tabla_Pais) 
hi_pais <- round((ni_pais / sum(ni_pais)) * 100, 2)

Tabla 2

variables <- variables |> 
  mutate(
    Cuadrante = case_when(
      latitude >= 0 & longitude >= 0 ~ "Norte - Este",
      latitude >= 0 & longitude < 0  ~ "Norte - Oeste",
      latitude < 0  & longitude >= 0 ~ "Sur - Este",
      latitude < 0  & longitude < 0  ~ "Sur - Oeste"
    )
  ) %>%   relocate(Cuadrante, .after = country)

Tabla 3

Tabla_Cuadrantes <- table(variables$Cuadrante)

ni_cuad <- as.vector(Tabla_Cuadrantes)
hi_cuad <- round((ni_cuad / sum(ni_cuad)) * 100, 2)

4.- Tabla de frecuencia

Tabla 1

TDF_Pais_Base <- data.frame(
  Pais = names(Tabla_Pais), 
  ni = ni_pais,
  hi = hi_pais
)
sumatoria_pais <- data.frame(
  Pais = "TOTAL", 
  ni = sum(ni_pais), 
  hi = 100
)
TDF_Pais_Suma <- rbind(TDF_Pais_Base, sumatoria_pais)
colnames(TDF_Pais_Suma) <- c("Pais", "Frecuencia Absoluta (ni)", "Frecuencia Relativa (hi %)")

kable(TDF_Pais_Suma, align = "c",
      caption = "Tabla N°1: Distribución de frecuencia de paìses del mundo para el análisis meteorológico del periodo mayo del 2024 a mayo del 2026") |> 
  kable_styling(full_width = TRUE, position = "center",
                bootstrap_options = c("striped", "hover", "condensed", "responsive")) |> 
  row_spec(0, bold = TRUE, color = "white", background = "#2C3E50") |> 
  row_spec(nrow(TDF_Pais_Suma), bold = TRUE, background = "#EAEDED") |> 
  footnote(general = "Fuente:GlobalWeatherRepository, https://www.kaggle.com/datasets/nelgiriyewithana/global-weather-repository\n.",
           general_title = "Grupo 2: ",
           footnote_as_chunk = TRUE,
           title_format = c("italic", "bold"))
Tabla N°1: Distribución de frecuencia de paìses del mundo para el análisis meteorológico del periodo mayo del 2024 a mayo del 2026
Pais Frecuencia Absoluta (ni) Frecuencia Relativa (hi %)
Afghanistan 729 0.51
Albania 727 0.51
Algeria 726 0.51
Andorra 728 0.51
Angola 728 0.51
Antigua and Barbuda 724 0.51
Argentina 726 0.51
Armenia 728 0.51
Australia 728 0.51
Austria 728 0.51
Azerbaijan 727 0.51
Bahamas 723 0.51
Bahrain 728 0.51
Bangladesh 727 0.51
Barbados 726 0.51
Belarus 727 0.51
Bélgica 1 0.00
Belgium 1364 0.96
Belize 723 0.51
Benin 727 0.51
Bhutan 726 0.51
Bolivia 1445 1.02
Bosnia and Herzegovina 728 0.51
Botswana 728 0.51
Brazil 724 0.51
Brunei Darussalam 726 0.51
Bulgaria 1674 1.18
Burkina Faso 728 0.51
Burundi 729 0.51
Cambodia 727 0.51
Cameroon 727 0.51
Canada 726 0.51
Cape Verde 728 0.51
Central African Republic 727 0.51
Chad 729 0.51
Chile 725 0.51
China 726 0.51
Colombia 1 0.00
Comoros 726 0.51
Congo 726 0.51
Costa Rica 721 0.51
Cote d’Ivoire 267 0.19
Croatia 725 0.51
Cuba 724 0.51
Cyprus 728 0.51
Czech Republic 726 0.51
Democratic Republic of Congo 726 0.51
Denmark 727 0.51
Djibouti 726 0.51
Dominica 724 0.51
Dominican Republic 725 0.51
Ecuador 723 0.51
Egypt 726 0.51
El Salvador 721 0.51
Equatorial Guinea 729 0.51
Eritrea 729 0.51
Estonia 726 0.51
Estonie 1 0.00
Ethiopia 727 0.51
Fiji Islands 729 0.51
Finland 728 0.51
France 727 0.51
Gabon 727 0.51
Gambia 725 0.51
Georgia 725 0.51
Germany 728 0.51
Ghana 729 0.51
Greece 724 0.51
Grenada 723 0.51
Guatemala 721 0.51
Guinea 727 0.51
Guinea-Bissau 727 0.51
Guyana 724 0.51
Haiti 725 0.51
Honduras 723 0.51
Hungary 810 0.57
Iceland 726 0.51
Inde 1 0.00
India 726 0.51
Indonesia 1457 1.03
Iran 1412 1.00
Iraq 729 0.51
Ireland 726 0.51
Israel 727 0.51
Italy 728 0.51
Jamaica 725 0.51
Japan 729 0.51
Jemen 1 0.00
Jordan 729 0.51
Kazakhstan 727 0.51
Kenya 729 0.51
Kiribati 727 0.51
Komoren 1 0.00
Kosovo 1 0.00
Kuwait 727 0.51
Kyrghyzstan 727 0.51
Lao People’s Democratic Republic 1 0.00
Latvia 726 0.51
Lebanon 727 0.51
Lesotho 726 0.51
Letonia 1 0.00
Liberia 727 0.51
Libya 1 0.00
Liechtenstein 727 0.51
Lithuania 727 0.51
Luxembourg 726 0.51
Macedonia 723 0.51
Madagascar 1186 0.84
Malásia 1 0.00
Malawi 728 0.51
Malaysia 727 0.51
Maldives 725 0.51
Mali 727 0.51
Malta 729 0.51
Marrocos 1 0.00
Marshall Islands 728 0.51
Mauritania 727 0.51
Mauritius 727 0.51
Mexico 723 0.51
Mexique 1 0.00
Micronesia 726 0.51
Monaco 725 0.51
Mongolia 727 0.51
Montenegro 726 0.51
Morocco 726 0.51
Mozambique 728 0.51
Myanmar 728 0.51
Namibia 728 0.51
Nepal 727 0.51
Netherlands 728 0.51
New Zealand 727 0.51
Nicaragua 722 0.51
Niger 728 0.51
Nigeria 728 0.51
North Korea 726 0.51
Norway 726 0.51
Oman 728 0.51
Pakistan 726 0.51
Palau 727 0.51
Panama 725 0.51
Papua New Guinea 728 0.51
Paraguay 727 0.51
Peru 723 0.51
Philippines 727 0.51
Poland 729 0.51
Polônia 1 0.00
Portugal 727 0.51
Qatar 726 0.51
Romania 726 0.51
Russia 782 0.55
Rwanda 728 0.51
Saint-Vincent-et-les-Grenadines 1 0.00
Saint Kitts and Nevis 726 0.51
Saint Lucia 727 0.51
Saint Vincent and the Grenadines 725 0.51
Samoa 722 0.51
San Marino 726 0.51
Saudi Arabia 727 0.51
Saudi Arabien 1 0.00
Senegal 729 0.51
Serbia 728 0.51
Seychelles Islands 726 0.51
Sierra Leone 725 0.51
Singapore 728 0.51
Slovakia 728 0.51
Slovenia 728 0.51
Solomon Islands 728 0.51
Somalia 726 0.51
South Africa 728 0.51
South Korea 726 0.51
Spain 728 0.51
Sri Lanka 728 0.51
Sudan 1452 1.02
Südkorea 1 0.00
Suriname 725 0.51
Swaziland 726 0.51
Sweden 727 0.51
Switzerland 776 0.55
Syria 727 0.51
Tajikistan 726 0.51
Tanzania 727 0.51
Thailand 1456 1.03
Timor-Leste 725 0.51
Togo 1 0.00
Tonga 726 0.51
Trinidad and Tobago 725 0.51
Tunisia 726 0.51
Turkey 1452 1.02
Turkmenistan 727 0.51
Turkménistan 1 0.00
Tuvalu 728 0.51
Uganda 728 0.51
Ukraine 729 0.51
United Arab Emirates 728 0.51
United Kingdom 726 0.51
United States of America 720 0.51
Uruguay 727 0.51
USA United States of America 3 0.00
Uzbekistan 729 0.51
Vanuatu 728 0.51
Vatican City 729 0.51
Venezuela 726 0.51
Vietnam 1181 0.83
Yemen 728 0.51
Zambia 728 0.51
Zimbabwe 726 0.51
Гватемала 1 0.00
Польша 1 0.00
Турция 1 0.00
كولومبيا 1 0.00
火鸡 | 1 | 0.00 |
TOTAL 141703 100.00
Grupo 2: Fuente:GlobalWeatherRepository, https://www.kaggle.com/datasets/nelgiriyewithana/global-weather-repository
.

Se observa que esta variable son paises entonces, la clasificamos por cuadrantes geogràficos

Tabla 2

TDF_Pais_Cuadrante_Base <- variables %>%
  group_by(country, Cuadrante) %>%
  summarise(
    ni = n(),                                           
    hi = round((n() / nrow(variables)) * 100, 2),        
    .groups = "drop"
  ) %>%
  arrange(country)                                       

fila_total_pc <- data.frame(
  country = "TOTAL",
  Cuadrante = "-",
  ni = sum(TDF_Pais_Cuadrante_Base$ni),
  hi = 100.00
)

TDF_Pais_Cuadrante_Suma <- rbind(TDF_Pais_Cuadrante_Base, fila_total_pc)
colnames(TDF_Pais_Cuadrante_Suma) <- c("País", "Cuadrante Geográfico", "Frecuencia Absoluta (ni)", "Frecuencia Relativa (hi %)")
kable(TDF_Pais_Cuadrante_Suma, align = "c",
      caption = "Tabla N°2: Distribución de frecuencias por pais y cuadrante geográfico para el análisis meteorológico del periodo
       mayo del 2024 a mayo del 2026") |>
  kable_styling(full_width = TRUE, position = "center",
                bootstrap_options = c("striped", "hover", "condensed", "responsive")) |>
  row_spec(0, bold = TRUE, color = "white", background = "#2C3E50") |>
  row_spec(nrow(TDF_Pais_Cuadrante_Suma), bold = TRUE, background = "#EAEDED") |>
  footnote(general = "Fuente: GlobalWeatherRepository",
           general_title = "Grupo 2: ",
           footnote_as_chunk = TRUE,
           title_format = c("italic", "bold"))
Tabla N°2: Distribución de frecuencias por pais y cuadrante geográfico para el análisis meteorológico del periodo mayo del 2024 a mayo del 2026
País Cuadrante Geográfico Frecuencia Absoluta (ni) Frecuencia Relativa (hi %)
Afghanistan Norte - Este 729 0.51
Albania Norte - Este 727 0.51
Algeria Norte - Este 726 0.51
Andorra Norte - Este 728 0.51
Angola Sur - Este 728 0.51
Antigua and Barbuda Norte - Oeste 724 0.51
Argentina Sur - Oeste 726 0.51
Armenia Norte - Este 728 0.51
Australia Sur - Este 728 0.51
Austria Norte - Este 728 0.51
Azerbaijan Norte - Este 727 0.51
Bahamas Norte - Oeste 723 0.51
Bahrain Norte - Este 728 0.51
Bangladesh Norte - Este 727 0.51
Barbados Norte - Oeste 726 0.51
Belarus Norte - Este 727 0.51
Belgium Norte - Este 1364 0.96
Belize Norte - Oeste 723 0.51
Benin Norte - Este 727 0.51
Bhutan Norte - Este 726 0.51
Bolivia Sur - Oeste 1445 1.02
Bosnia and Herzegovina Norte - Este 728 0.51
Botswana Sur - Este 728 0.51
Brazil Sur - Oeste 724 0.51
Brunei Darussalam Norte - Este 726 0.51
Bulgaria Norte - Este 1674 1.18
Burkina Faso Norte - Oeste 728 0.51
Burundi Sur - Este 729 0.51
Bélgica Norte - Este 1 0.00
Cambodia Norte - Este 727 0.51
Cameroon Norte - Este 727 0.51
Canada Norte - Oeste 726 0.51
Cape Verde Norte - Oeste 728 0.51
Central African Republic Norte - Este 727 0.51
Chad Norte - Este 729 0.51
Chile Sur - Oeste 725 0.51
China Norte - Este 726 0.51
Colombia Norte - Oeste 1 0.00
Comoros Sur - Este 726 0.51
Congo Sur - Este 726 0.51
Costa Rica Norte - Oeste 721 0.51
Cote d’Ivoire Norte - Oeste 267 0.19
Croatia Norte - Este 725 0.51
Cuba Norte - Oeste 724 0.51
Cyprus Norte - Este 728 0.51
Czech Republic Norte - Este 726 0.51
Democratic Republic of Congo Sur - Este 726 0.51
Denmark Norte - Este 727 0.51
Djibouti Norte - Este 726 0.51
Dominica Norte - Oeste 724 0.51
Dominican Republic Norte - Oeste 725 0.51
Ecuador Sur - Oeste 723 0.51
Egypt Norte - Este 726 0.51
El Salvador Norte - Oeste 721 0.51
Equatorial Guinea Norte - Este 729 0.51
Eritrea Norte - Este 729 0.51
Estonia Norte - Este 726 0.51
Estonie Norte - Este 1 0.00
Ethiopia Norte - Este 727 0.51
Fiji Islands Sur - Este 729 0.51
Finland Norte - Este 728 0.51
France Norte - Este 727 0.51
Gabon Norte - Este 727 0.51
Gambia Norte - Oeste 725 0.51
Georgia Norte - Este 725 0.51
Germany Norte - Este 728 0.51
Ghana Norte - Oeste 729 0.51
Greece Norte - Este 724 0.51
Grenada Norte - Oeste 723 0.51
Guatemala Norte - Oeste 721 0.51
Guinea Norte - Oeste 727 0.51
Guinea-Bissau Norte - Oeste 727 0.51
Guyana Norte - Oeste 724 0.51
Haiti Norte - Oeste 725 0.51
Honduras Norte - Oeste 723 0.51
Hungary Norte - Este 810 0.57
Iceland Norte - Oeste 726 0.51
Inde Norte - Este 1 0.00
India Norte - Este 726 0.51
Indonesia Sur - Este 1457 1.03
Iran Norte - Este 1412 1.00
Iraq Norte - Este 729 0.51
Ireland Norte - Oeste 726 0.51
Israel Norte - Este 727 0.51
Italy Norte - Este 728 0.51
Jamaica Norte - Oeste 725 0.51
Japan Norte - Este 729 0.51
Jemen Norte - Este 1 0.00
Jordan Norte - Este 729 0.51
Kazakhstan Norte - Este 727 0.51
Kenya Sur - Este 729 0.51
Kiribati Sur - Este 727 0.51
Komoren Sur - Este 1 0.00
Kosovo Norte - Este 1 0.00
Kuwait Norte - Este 727 0.51
Kyrghyzstan Norte - Este 727 0.51
Lao People’s Democratic Republic Norte - Este 1 0.00
Latvia Norte - Este 726 0.51
Lebanon Norte - Este 727 0.51
Lesotho Sur - Este 726 0.51
Letonia Norte - Este 1 0.00
Liberia Norte - Oeste 727 0.51
Libya Norte - Este 1 0.00
Liechtenstein Norte - Este 727 0.51
Lithuania Norte - Este 727 0.51
Luxembourg Norte - Este 726 0.51
Macedonia Norte - Este 723 0.51
Madagascar Sur - Este 1186 0.84
Malawi Sur - Este 728 0.51
Malaysia Norte - Este 727 0.51
Maldives Norte - Este 725 0.51
Mali Norte - Oeste 727 0.51
Malta Norte - Este 729 0.51
Malásia Norte - Este 1 0.00
Marrocos Norte - Oeste 1 0.00
Marshall Islands Norte - Este 728 0.51
Mauritania Norte - Oeste 727 0.51
Mauritius Sur - Este 727 0.51
Mexico Norte - Oeste 723 0.51
Mexique Norte - Oeste 1 0.00
Micronesia Norte - Este 726 0.51
Monaco Norte - Este 725 0.51
Mongolia Norte - Este 727 0.51
Montenegro Norte - Este 726 0.51
Morocco Norte - Oeste 726 0.51
Mozambique Sur - Este 728 0.51
Myanmar Norte - Este 728 0.51
Namibia Sur - Este 728 0.51
Nepal Norte - Este 727 0.51
Netherlands Norte - Este 728 0.51
New Zealand Sur - Este 727 0.51
Nicaragua Norte - Oeste 722 0.51
Niger Norte - Este 728 0.51
Nigeria Norte - Este 728 0.51
North Korea Norte - Este 726 0.51
Norway Norte - Este 726 0.51
Oman Norte - Este 728 0.51
Pakistan Norte - Este 726 0.51
Palau Norte - Este 727 0.51
Panama Norte - Oeste 725 0.51
Papua New Guinea Sur - Este 728 0.51
Paraguay Sur - Oeste 727 0.51
Peru Sur - Oeste 723 0.51
Philippines Norte - Este 727 0.51
Poland Norte - Este 729 0.51
Polônia Norte - Este 1 0.00
Portugal Norte - Oeste 727 0.51
Qatar Norte - Este 726 0.51
Romania Norte - Este 726 0.51
Russia Norte - Este 782 0.55
Rwanda Sur - Este 728 0.51
Saint Kitts and Nevis Norte - Oeste 726 0.51
Saint Lucia Norte - Oeste 727 0.51
Saint Vincent and the Grenadines Norte - Oeste 725 0.51
Saint-Vincent-et-les-Grenadines Norte - Oeste 1 0.00
Samoa Sur - Oeste 722 0.51
San Marino Norte - Este 726 0.51
Saudi Arabia Norte - Este 727 0.51
Saudi Arabien Norte - Este 1 0.00
Senegal Norte - Oeste 729 0.51
Serbia Norte - Este 728 0.51
Seychelles Islands Sur - Este 726 0.51
Sierra Leone Norte - Oeste 725 0.51
Singapore Norte - Este 728 0.51
Slovakia Norte - Este 728 0.51
Slovenia Norte - Este 728 0.51
Solomon Islands Sur - Este 728 0.51
Somalia Norte - Este 726 0.51
South Africa Sur - Este 728 0.51
South Korea Norte - Este 726 0.51
Spain Norte - Oeste 728 0.51
Sri Lanka Norte - Este 728 0.51
Sudan Norte - Este 1452 1.02
Suriname Norte - Oeste 725 0.51
Swaziland Sur - Este 726 0.51
Sweden Norte - Este 727 0.51
Switzerland Norte - Este 776 0.55
Syria Norte - Este 727 0.51
Südkorea Norte - Este 1 0.00
Tajikistan Norte - Este 726 0.51
Tanzania Sur - Este 727 0.51
Thailand Norte - Este 1456 1.03
Timor-Leste Sur - Este 725 0.51
Togo Norte - Este 1 0.00
Tonga Sur - Oeste 726 0.51
Trinidad and Tobago Norte - Oeste 725 0.51
Tunisia Norte - Este 726 0.51
Turkey Norte - Este 1452 1.02
Turkmenistan Norte - Este 727 0.51
Turkménistan Norte - Este 1 0.00
Tuvalu Sur - Este 728 0.51
USA United States of America Norte - Este 1 0.00
USA United States of America Norte - Oeste 2 0.00
Uganda Norte - Este 728 0.51
Ukraine Norte - Este 729 0.51
United Arab Emirates Norte - Este 728 0.51
United Kingdom Norte - Oeste 726 0.51
United States of America Norte - Oeste 720 0.51
Uruguay Sur - Oeste 727 0.51
Uzbekistan Norte - Este 729 0.51
Vanuatu Sur - Este 728 0.51
Vatican City Norte - Este 729 0.51
Venezuela Norte - Oeste 726 0.51
Vietnam Norte - Este 1181 0.83
Yemen Norte - Este 728 0.51
Zambia Sur - Este 728 0.51
Zimbabwe Sur - Este 726 0.51
Гватемала Norte - Oeste 1 0.00
Польша Norte - Este 1 0.00
Турция Norte - Este 1 0.00
كولومبيا Norte - Oeste 1 0.00
火鸡 | Norte - Este | 1 | 0.00 |
TOTAL
141703 100.00
Grupo 2: Fuente: GlobalWeatherRepository
Tabla 3
TDF_Cuadrantes_Base <- data.frame(
  Cuadrante = names(Tabla_Cuadrantes),
  ni = ni_cuad,
  hi = hi_cuad
)
fila_total_cuad <- data.frame(
  Cuadrante = "TOTAL",
  ni = sum(ni_cuad),
  hi = 100
)
TDF_Cuadrantes_Suma <- rbind(TDF_Cuadrantes_Base, fila_total_cuad)
colnames(TDF_Cuadrantes_Suma) <- c("Cuadrante Geográfico", "Frecuencia Absoluta (ni)", "Frecuencia Relativa (hi %)")

kable(TDF_Cuadrantes_Suma, align = "c",
      caption = "Tabla N°3: Distribución de frecuencias globales por cuadrantes geográficos mundiales para el análisis meteorológico del periodo
       mayo del 2024 a  mayo del 2026") |>
  kable_styling(full_width = TRUE, position = "center",
                bootstrap_options = c("striped", "hover", "condensed", "responsive")) |>
  row_spec(0, bold = TRUE, color = "white", background = "#2C3E50") |>
  row_spec(nrow(TDF_Cuadrantes_Suma), bold = TRUE, background = "#EAEDED") |>
  footnote(general = "Fuente: GlobalWeatherRepository",
           general_title = "Grupo 2: ",
           footnote_as_chunk = TRUE,
           title_format = c("italic", "bold"))
Tabla N°3: Distribución de frecuencias globales por cuadrantes geográficos mundiales para el análisis meteorológico del periodo mayo del 2024 a mayo del 2026
Cuadrante Geográfico Frecuencia Absoluta (ni) Frecuencia Relativa (hi %)
Norte - Este 79270 55.94
Norte - Oeste 31455 22.20
Sur - Este 23010 16.24
Sur - Oeste 7968 5.62
TOTAL 141703 100.00
Grupo 2: Fuente: GlobalWeatherRepository

5.-Gráficos

5.1.- Diagrama de barras por cuadrante geográfico

ggplot(TDF_Cuadrantes_Base, aes(x = reorder(Cuadrante, -ni), y = ni)) +
  geom_bar(stat = "identity", fill = "skyblue", color = "black", width = 0.6) +
  geom_text(aes(label = format(ni, big.mark = ",")), vjust = -0.5, size = 4, fontface = "bold") +
  scale_y_continuous(
    labels = scales::comma, 
    limits = c(0, 80000), 
    breaks = seq(0, 80000, by = 20000)
  ) +
  labs(
    title = "Gráfica N.1: Cantidad de Registros por Cuadrante Geográfico 
     observada de la tabla 3 de los países del período mayo 
    del 2024 a mayo del 2026",
    x = "Cuadrante Geográfico",
    y = "Cantidad de Registros (ni)"
  ) +
  theme_bw(base_size = 12) +
  theme(
    plot.title = element_text(face = "bold", size = 14, hjust = 0.5),
    plot.subtitle = element_text(size = 11, hjust = 0.5, face = "italic"),
    panel.grid.major.x = element_blank(),
    panel.grid.minor = element_blank()    
  )

5.2.- Diagrama de barras porcentual por cuadrante geográfico

ggplot(TDF_Cuadrantes_Base, aes(x = reorder(Cuadrante, -hi), y = hi)) +
  geom_bar(stat = "identity", fill = "skyblue", color = "black", width = 0.6) +
  geom_text(aes(label = paste0(hi, "%")), vjust = -0.5, size = 4, fontface = "bold") +
  scale_y_continuous(
    limits = c(0, 60), 
    breaks = seq(0, 60, by = 20)
  ) +
  labs(
    title = "Gráfica N.2: Distribución Porcentual por cuadrante geográfico 
    Mundial recopilados en la tabla 3 del período mayodel 2024 a 
    mayo del 2026 ",
    x = "Cuadrante Geográfico",
    y = "Porcentaje del Total (hi %)"
  ) +
  theme_bw(base_size = 12) +
  theme(
    plot.title = element_text(face = "bold", size = 14, hjust = 0.5),
    plot.subtitle = element_text(size = 11, hjust = 0.5, face = "italic"),
    panel.grid.major.x = element_blank(),
    panel.grid.minor = element_blank()    
  )

5.3.- Diagrama de barras general

ggplot(TDF_Cuadrantes_Base, aes(x = reorder(Cuadrante, -ni), y = ni)) +
  geom_bar(stat = "identity", fill = "skyblue", color = "black", width = 0.6) +
  geom_text(aes(label = format(ni, big.mark = ",")), vjust = -0.5, size = 4, fontface = "bold") +
  scale_y_continuous(
    labels = scales::comma, 
    limits = c(0, 141703), 
    breaks = seq(0, 141703, by = 20000)
  ) +
  labs(
    title = "Gráfica N.3: Cantidad de Registros por Cuadrante Geográfico 
    en relacion al tamaño muestral del período de mayo 
    del 2024 a mayo del 2026 ",
    x = "Cuadrante Geográfico",
    y = "Cantidad de Registros (ni)"
  ) +
  theme_bw(base_size = 12) +
  theme(
    plot.title = element_text(face = "bold", size = 14, hjust = 0.5),
    plot.subtitle = element_text(size = 11, hjust = 0.5, face = "italic"),
    panel.grid.major.x = element_blank(),
    panel.grid.minor = element_blank()    
  )

5.4.- Diagrama de barras porcentual general

ggplot(TDF_Cuadrantes_Base, aes(x = reorder(Cuadrante, -hi), y = hi)) +
  geom_bar(stat = "identity", fill = "skyblue", color = "black", width = 0.6) +
  geom_text(aes(label = paste0(hi, "%")), vjust = -0.5, size = 4, fontface = "bold") +
  scale_y_continuous(
    limits = c(0, 100), 
    breaks = seq(0, 100, by = 20)
  ) +
  labs(
    title = "Gráfica N.4: Distribución Porcentual por Cuadrante Geográfico con 
    respecto al 100% del tamaño muestral",
    x = "Cuadrante Geográfico",
    y = "Porcentaje del Total (hi %)"
  ) +
  theme_bw(base_size = 12) +
  theme(
    plot.title = element_text(face = "bold", size = 14, hjust = 0.5),
    plot.subtitle = element_text(size = 11, hjust = 0.5, face = "italic"),
    panel.grid.major.x = element_blank(),
    panel.grid.minor = element_blank()    
  )

5.5.- Gráfica circular

TDF_Cuadrantes_Grafico <- TDF_Cuadrantes_Base |> 
  arrange(desc(Cuadrante)) |> 
  mutate(posicion_texto = cumsum(hi) - 0.5 * hi)

ggplot(TDF_Cuadrantes_Grafico, aes(x = "", y = hi, fill = Cuadrante)) +
  geom_bar(stat = "identity", width = 1, color = "black") +
  coord_polar("y", start = 0) +
  geom_text(aes(y = posicion_texto, label = paste0(hi, "%")), size = 4.5, fontface = "bold") +
  scale_fill_manual(values = c(
    "Norte - Este"  = "#1F78B4",  
    "Norte - Oeste" = "#33A02C",  
    "Sur - Este"    = "#FF7F00",  
    "Sur - Oeste"   = "#E31A1C"   
  )) +
  labs(
    title = "                         Gráfica N.5: Distribución porcentual por cuadrante geográfico mundial con 
    respecto al 100% del tamaño muestral desde el 2024 a 2026"
  ) +
  theme_void(base_size = 12) +
  theme(
    plot.title = element_text(face = "bold", size = 14, hjust = 0.5),
    plot.subtitle = element_text(size = 11, hjust = 0.5, face = "italic"),
    legend.position = "right",
    legend.title = element_text(face = "bold")
  ) 

6.- Indicadores de frecuencia

frecuencia_max <- max(TDF_Cuadrantes_Base$ni)
modas <- TDF_Cuadrantes_Base$Cuadrante[TDF_Cuadrantes_Base$ni == frecuencia_max]
Mo_cuadrante <- paste(modas, collapse = " - ")

tabla_indicadores <- data.frame(
  "Variable" = c("Pais"),
  "Rango" = c("-"),
  "X" = c("-"),      
  "Me" = c("-"),     
  "Mo" = c(Mo_cuadrante), 
  "V" = c("-"),      
  "Sd" = c("-"),     
  "Cv" = c("-"),     
  "As" = c("-"),     
  "K" = c("-"),      
  "Valores Atipicos" = c("No hay valores atípicos")
)
kable(tabla_indicadores, align = 'c', 
      caption = "Indicadores de la variable pais") %>%
  kable_styling(full_width = TRUE, position = "center", 
                bootstrap_options = c("striped", "hover", "condensed", "responsive")) %>%
footnote(general = "Análisis de tendencia central para la variable  pais, donde se destaca el cuadrante con mayor repetición de datos.", 
         general_title = "Nota: ", 
         footnote_as_chunk = TRUE, 
         title_format = c("italic", "bold"))
Indicadores de la variable pais
Variable Rango X Me Mo V Sd Cv As K Valores.Atipicos
Pais
Norte - Este
No hay valores atípicos
Nota: Análisis de tendencia central para la variable pais, donde se destaca el cuadrante con mayor repetición de datos.

7.- Conclusiones

la categoria Norte_Este correspondiente a uno de los cuadrantes geograficos concentra una mayor moda se encuantran en el periodo mayo del 2024 a mayo del 2026