FECHA: 22/11/2025
#Estadistica Descriptiva
#Juan Arteaga
#22/11/2025
#VARIABLE CUALITATIVA ORDINAL:
#Cargar los Datos
setwd("C:/Users/arian/OneDrive/Escritorio/3 SEMESTRE/ESTADISTICA Y PROBABILIDAD")
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" ...
#Nivel_Enfermedad
Nivel_Enfermedad<-datos$Disease_Severity
# Tabla de distribución de frecuencia
TDF_Nivel_Enfermedad<-data.frame(table(Nivel_Enfermedad))
ni <- TDF_Nivel_Enfermedad$Freq
hi <- round((ni / sum(ni)) * 100, 2)
Nivel_Enfermedad <- TDF_Nivel_Enfermedad$Nivel_Enfermedad
TDF_Nivel_Enfermedad <- data.frame(Nivel_Enfermedad, ni, hi)
Summary <- data.frame(Nivel_Enfermedad = "TOTAL", ni = sum(ni),hi = 100)
TDF_Enfermedad_suma<-rbind(TDF_Nivel_Enfermedad, Summary)
colnames(TDF_Enfermedad_suma) <- c("Nivel Enfermedad", "ni", "hi(%)")
# Ordenar la tabla en el orden deseado
TDF_Enfermedad_suma$`Nivel Enfermedad` <- factor(
TDF_Enfermedad_suma$`Nivel Enfermedad`,
levels = c("Severe", "Moderate", "Mild", "TOTAL")
)
TDF_Enfermedad_suma <- TDF_Enfermedad_suma[
order(TDF_Enfermedad_suma$`Nivel Enfermedad`),
]
#TABLA
library(knitr)
library(kableExtra)
kable(
TDF_Enfermedad_suma,
align = 'c',
row.names = FALSE,
caption = "Tabla N12: Distribucion de frecuencias de los niveles de enfermedad"
) %>%
kable_styling(
full_width = FALSE,
position = "center",
bootstrap_options = c("striped", "hover", "condensed")
)
Tabla N12: Distribucion de frecuencias de los niveles de enfermedad
|
Nivel Enfermedad
|
ni
|
hi(%)
|
|
Severe
|
1023
|
34.10
|
|
Moderate
|
998
|
33.27
|
|
Mild
|
979
|
32.63
|
|
TOTAL
|
3000
|
100.00
|