This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Ctrl+Shift+Enter.
#Estadistica Descriptiva
#Lorien Arcentales
#20/11/2025
library(gt)
library(dplyr)
#Cargar Datos
datos<-read.csv("city_day.csv",header = TRUE,dec = ".",
sep = ",")
#Tablas Cualitativas
#CIUDAD
ciudad <- datos$City
#Tabla de Distribucion de Frecuencia
TDF_ciudad <-data.frame(table(ciudad))
ni <- TDF_ciudad$Freq
hi <- round((ni / sum(ni)) * 100, 2)
ciudad <- TDF_ciudad$ciudad
TDF_ciudad <- data.frame(ciudad, ni, hi)
Summary <- data.frame(ciudad = "TOTAL", ni = sum(ni),hi = 100)
TDF_ciudad <- rbind(TDF_ciudad,Summary)
colnames(TDF_ciudad) <- c("Ciudades", "ni", "hi(%)")
# TABLA
TDF_ciudad %>%
gt() %>%
tab_header(
title = md("*Tabla Nro. 1*"),
subtitle = md("**Distribucion de frecuencia de ciudades,estudio calidad del aire en India entre 2015-2020 **")
) %>%
tab_source_note(
source_note = md("Autor: Grupo 2\n Fuente:https://www.kaggle.com/datasets/rohanrao/air-quality-data-in-india")
) %>%
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. 1 | ||
| **Distribucion de frecuencia de ciudades,estudio calidad del aire en India entre 2015-2020 ** | ||
| Ciudades | ni | hi(%) |
|---|---|---|
| Ahmedabad | 2009 | 6.80 |
| Aizawl | 113 | 0.38 |
| Amaravati | 951 | 3.22 |
| Amritsar | 1221 | 4.13 |
| Bengaluru | 2009 | 6.80 |
| Bhopal | 289 | 0.98 |
| Brajrajnagar | 938 | 3.18 |
| Chandigarh | 304 | 1.03 |
| Chennai | 2009 | 6.80 |
| Coimbatore | 386 | 1.31 |
| Delhi | 2009 | 6.80 |
| Ernakulam | 162 | 0.55 |
| Gurugram | 1679 | 5.69 |
| Guwahati | 502 | 1.70 |
| Hyderabad | 2006 | 6.79 |
| Jaipur | 1114 | 3.77 |
| Jorapokhar | 1169 | 3.96 |
| Kochi | 162 | 0.55 |
| Kolkata | 814 | 2.76 |
| Lucknow | 2009 | 6.80 |
| Mumbai | 2009 | 6.80 |
| Patna | 1858 | 6.29 |
| Shillong | 310 | 1.05 |
| Talcher | 925 | 3.13 |
| Thiruvananthapuram | 1112 | 3.77 |
| Visakhapatnam | 1462 | 4.95 |
| TOTAL | 29531 | 100.00 |
| Autor: Grupo 2 Fuente:https://www.kaggle.com/datasets/rohanrao/air-quality-data-in-india | ||