UNIVERSIDAD CENTRAL DEL ECUADOR

PROYECTO:ANALISIS ESTADÍSTICO DE LA CALIDAD DEL AIRE EN LA INDIA

FECHA: 22/11/2025

#Estadística Descriptiva
#LLUMITASIG DANIELA
#15/11/2025

library(gt)
library(dplyr)

#Cargar los datos 

datos<-read.csv("C:/Users/JOSELYN/Desktop/kangle/stations (1).csv",header = TRUE,dec = ".",sep = ",")

#Tablas Cualitativas Nominales

#State
State<- datos$State
#Tabla de distribución de frecuencia
TDF_State<- data.frame(table(State))
ni <- TDF_State$Freq
hi <- round((ni / sum(ni)) *100,2)
State <- TDF_State$State
TDF_State <- data.frame(State,ni,hi)
Summary <- data.frame(State = "TOTAL", ni=sum(ni), hi = 100)

TDF_State_suma <- rbind(TDF_State,Summary)

colnames(TDF_State_suma) <- c("Nombre_Oficial", "ni", "hi(%)")

# TABLA 

TDF_State_suma %>%
  gt() %>%
  tab_header(
    title = md("Tabla Nro. 2"),
    subtitle = md("Tabla de distribución de regiones donde se encuentran las estaciones de monitoreo")
  ) %>%
  tab_source_note(
    source_note = md("Fuente: Datos procesados por el autor a partir de archivo city.day.csv ")
  ) %>%
  tab_style(
    style = cell_borders(
      sides = "left",
      color = "black",
      weight = px(2),
      style = "solid"
    ),
    locations = cells_body()
  ) %>%
  tab_style(
    style = cell_borders(
      sides = "right",
      color = "black",
      weight = px(2),
      style = "solid"
    ),
    locations = cells_body()
  ) %>%
  tab_style(
    style = cell_borders(
      sides = "left",
      color = "black",
      weight = px(2),
      style = "solid"
    ),
    locations = cells_column_labels()
  ) %>%
  tab_style(
    style = cell_borders(
      sides = "right",
      color = "black",
      weight = px(2),
      style = "solid"
    ),
    locations = cells_column_labels()
  )%>%
  tab_options(
    table.border.top.color = "black",
    table.border.bottom.color = "black",
    table.border.top.style = "solid",
    table.border.bottom.style = "solid",
    column_labels.border.top.color = "black",
    column_labels.border.bottom.color = "black",
    column_labels.border.bottom.width = px(2),
    row.striping.include_table_body = TRUE,
    heading.border.bottom.color = "black",
    heading.border.bottom.width = px(2),
    table_body.hlines.color = "gray",
    table_body.border.bottom.color = "black"
  )
Tabla Nro. 2
Tabla de distribución de regiones donde se encuentran las estaciones de monitoreo
Nombre_Oficial ni hi(%)
Andhra Pradesh 5 2.17
Assam 1 0.43
Bihar 10 4.35
Chandigarh 1 0.43
Delhi 38 16.52
Gujarat 6 2.61
Haryana 29 12.61
Jharkhand 1 0.43
Karnataka 20 8.70
Kerala 8 3.48
Madhya Pradesh 16 6.96
Maharashtra 22 9.57
Meghalaya 1 0.43
Mizoram 1 0.43
Odisha 2 0.87
Punjab 8 3.48
Rajasthan 10 4.35
Tamil Nadu 5 2.17
Telangana 6 2.61
Uttar Pradesh 26 11.30
West Bengal 14 6.09
TOTAL 230 100.00
Fuente: Datos procesados por el autor a partir de archivo city.day.csv