UNIVERSIDAD CENTRAL DEL ECUADOR

PROYECTO:ESTUDIO ESTADÍSTICO DE LA CONTAMINACIÓN DEL SUELO Y SU IMPACTO EN LA SALUD

FECHA: 23/11/2025

#Estadística Descriptiva
#Juan Arteaga
#23/11/2025


datos<-read.csv("soil_pollution_diseases.csv",header = TRUE,dec = ".",sep = ",")
str(datos)
## 'data.frame':    3000 obs. of  24 variables:
##  $ Case_ID                      : chr  "CASE_100000" "CASE_100001" "CASE_100002" "CASE_100003" ...
##  $ Date_Reported                : chr  "12/9/2024" "1/1/2024" "24/2/2025" "24/9/2024" ...
##  $ Region                       : chr  "Africa" "Africa" "Europe" "Asia" ...
##  $ Country                      : chr  "Pakistan" "Germany" "Germany" "USA" ...
##  $ Pollutant_Type               : chr  "Lead" "Lead" "Lead" "Lead" ...
##  $ Pollutant_Concentration_mg_kg: int  7804 1633 16733 8923 9393 12347 644 1171 11161 12159 ...
##  $ Soil_pH                      : int  83 796 535 566 764 518 489 814 524 819 ...
##  $ Temperature_C                : int  356 310 164 314 170 123 339 191 439 131 ...
##  $ Humidity_.                   : int  649 731 338 305 586 912 530 697 781 347 ...
##  $ Rainfall_mm                  : int  624 82 1217 1169 2370 3863 488 1247 3758 181 ...
##  $ Crop_Type                    : chr  "Wheat" "Potato" "Soybean" "Wheat" ...
##  $ Farming_Practice             : chr  "Integrated" "Permaculture" "Organic" "Permaculture" ...
##  $ Nearby_Industry              : chr  "Mining" "Mining" "Chemical" "None" ...
##  $ Water_Source_Type            : chr  "Well" "Irrigation Canal" "River" "Irrigation Canal" ...
##  $ Soil_Texture                 : chr  "Sandy" "Silty" "Clay" "Silty" ...
##  $ Soil_Organic_Matter_.        : int  198 971 549 398 94 818 52 544 90 359 ...
##  $ Disease_Type                 : chr  "Gastrointestinal Disease" "Cancer" "Gastrointestinal Disease" "Neurological Disorder" ...
##  $ Disease_Severity             : chr  "Moderate" "Mild" "Severe" "Severe" ...
##  $ Health_Symptoms              : chr  "Breathing Difficulty" "Breathing Difficulty" "Nausea" "Fatigue" ...
##  $ Age_Group_Affected           : chr  "Adults" "Elderly" "Children" "Adults" ...
##  $ Gender_Most_Affected         : chr  "Male" "Both" "Both" "Male" ...
##  $ Mitigation_Measure           : chr  "Government Regulation" "Community Awareness" "Soil Remediation" "Community Awareness" ...
##  $ Case_Resolved                : chr  "No" "Yes" "Yes" "Yes" ...
##  $ Follow_Up_Required           : chr  "Yes" "No" "No" "No" ...
#Tablas Cualitativas Nominales

#Industria Cercana

Industria_Cercana <- datos$Nearby_Industry

#Tabla de distribución de frecuencia

TDF_Industria_Cercana <- data.frame(table(Industria_Cercana))
ni <- TDF_Industria_Cercana$Freq
hi <- round((ni / sum(ni)) *100,2)


#Graficas
# Diagrama de barrras local ni

barplot(ni, main = "Gráfica N°26: Distribución de frecuencias de las Industrias Cercanas 
        al lugar de estudio",
        xlab = "Industria cercana",
        ylab = "Cantidad",
        col = "red",
        ylim = c(0,800),
        las = 2,
        cex.names = 0.6,
        names.arg = TDF_Industria_Cercana$Industria_Cercana)

#Diagrama de barras global ni 

barplot(ni, main = "Gráfica N°27: Distribución de frecuencias 
de las Industrias Cercanas al lugar de estudio",
        xlab = "Industria cercana",
        ylab = "Cantidad",
        col = "skyblue",
        ylim = c(0,3000),
        las=2,
        cex.names = 0.6,
        names.arg = TDF_Industria_Cercana$Industria_Cercana)

#Diagrama de barras local hi(%)

barplot(hi, main = "Gráfica N°28: Distribución de frecuencias porcentual de frecuencias 
de las Industrias Cercanas al lugar de estudio",
        xlab = "Práctica Agricola",
        ylab = "Porcentaje",
        col = "green",
        ylim = c(0,30),
        las = 2,
        cex.names = 0.6,
        names.arg = TDF_Industria_Cercana$Industria_Cercana)

#Diagrama de barras global hi(%)

barplot(hi, main = "Gráfica N°29: Distribución de frecuencias porcentual de frecuencias 
de las Industrias Cercanas al lugar de estudio",
        xlab = "Práctica Agricola",
        ylab = "Porcentaje",
        col = "blue",
        ylim = c(0,100),
        las = 1,
        cex.names = 0.6,
        names.arg = TDF_Industria_Cercana$Industria_Cercana)

# Diagrama Circular

# Etiquetas con número + símbolo %
etiquetas <- paste0(hi, " %")


colores <- c("yellow", "khaki1", "gold", "orange", "darkorange", "red")


par(mar = c(2, 2, 4, 6))

pie(
  hi,
  labels = etiquetas,
  col = colores,
  main = "Gráfica N°30 Distribución porcentual de frecuencias 
de las Industrias Cercanas al lugar de estudio",
  cex = 1
)

legend(
  "topright",
  legend = TDF_Industria_Cercana$Industria_Cercana,
  fill = colores,
  title = "Leyenda",
  cex = 0.9,
  xpd = TRUE
)