1 Configuración y Carga de Datos

datos_originales <- readr::read_delim(
  ruta, delim=delimitador, trim_ws=TRUE,
  show_col_types=FALSE, name_repair="minimal"
)
## Carga exitosa: 47.501 registros.

2 Extracción y Limpieza de la Variable

# Solo se omiten los valores realmente faltantes para el análisis;
# el CSV no se modifica en ningún momento.
region_limpia <- datos_originales |>
  dplyr::transmute(Region=stringr::str_squish(as.character(.data[[columna_region]]))) |>
  dplyr::filter(!is.na(Region), Region != "",
                !toupper(Region) %in% c("NA", "N/A", "NULL"))
N <- nrow(region_limpia)
if (N == 0L) stop("No hay registros válidos de REGION.")
k_regiones <- dplyr::n_distinct(region_limpia$Region)
cat("Registros válidos:", fmt_entero(N),
    " | Regiones distintas:", fmt_entero(k_regiones), "\n")
## Registros válidos: 47.492  | Regiones distintas: 9

3 Identificación de la Variable

VARIABLE TIPO ESCALA DE MEDICIÓN UNIDAD DE ANÁLISIS CATEGORÍAS (k) REGISTROS VÁLIDOS (N)
REGION (Región) Cualitativa nominal Nominal Pozo regulado 9 47.492

4 Tabla de Distribución de Frecuencias

cat(crear_cuadro(
  tabla_frecuencias, 1,
  "Distribución de frecuencias de los pozos regulados según la región, Nueva York, 1860 - 2026"
))
Cuadro N° 1: Distribución de frecuencias de los pozos regulados según la región, Nueva York, 1860 - 2026
REGIÓN FRECUENCIA ABSOLUTA (nᵢ) FRECUENCIA RELATIVA (hᵢ) FRECUENCIA RELATIVA PORCENTUAL (%)
9 40.003 0.8423 84.23%
1 4 0.0001 0.01%
6 114 0.0024 0.24%
5 19 0.0004 0.04%
3 112 0.0024 0.24%
4 96 0.0020 0.20%
8 5.212 0.1097 10.97%
7 1.685 0.0355 3.55%
2 247 0.0052 0.52%
TOTAL GENERAL 47.492 1.0000 100.00%

Fuente: Oil, Gas & Other Regulated Wells: Beginning 1860.

5 Representación Gráfica

5.1 Gráfica N° 1 — Frecuencia absoluta (nᵢ) local

ggplot2::ggplot(tabla_local, ggplot2::aes(x=Region,y=ni,fill=Region)) +
  ggplot2::geom_col(width=.72,color="#244861",linewidth=.36) +
  ggplot2::geom_text(ggplot2::aes(label=fmt_entero(ni)),vjust=-.48,
                     size=4.5,fontface="bold",color="#15364C") +
  ggplot2::scale_fill_manual(values=colores) +
  escala_regiones +
  ggplot2::scale_y_continuous(limits=c(0,limite_ni_local),
                              labels=fmt_entero,
                              expand=ggplot2::expansion(mult=c(0,0))) +
  ggplot2::labs(title="Gráfica N° 1: Frecuencia absoluta (nᵢ) local",
                x="Región",y="Frecuencia absoluta (nᵢ)",caption=fuente_graficas) +
  tema_barras

5.2 Gráfica N° 2 — Frecuencia absoluta (nᵢ) global

ggplot2::ggplot(tabla_global, ggplot2::aes(x=Region,y=ni)) +
  ggplot2::geom_col(fill="#286492",color="#244861",width=.72,linewidth=.36) +
  ggplot2::geom_text(ggplot2::aes(label=fmt_entero(ni)),vjust=-.48,
                     size=4.5,fontface="bold",color="#15364C") +
  escala_regiones +
  ggplot2::scale_y_continuous(limits=c(0,limite_ni_global),
                              labels=fmt_entero,
                              expand=ggplot2::expansion(mult=c(0,0))) +
  ggplot2::labs(title="Gráfica N° 2: Frecuencia absoluta (nᵢ) global",
                x="Región",y="Frecuencia absoluta (nᵢ)",caption=fuente_graficas) +
  tema_barras

5.3 Gráfica N° 3 — Frecuencia relativa (hᵢ) local

ggplot2::ggplot(tabla_local, ggplot2::aes(x=Region,y=hi,fill=Region)) +
  ggplot2::geom_col(width=.72,color="#244861",linewidth=.36) +
  ggplot2::geom_text(ggplot2::aes(label=sprintf("%.2f%%",100*hi)),vjust=-.48,
                     size=4.3,fontface="bold",color="#15364C") +
  ggplot2::scale_fill_manual(values=colores) +
  escala_regiones +
  ggplot2::scale_y_continuous(limits=c(0,limite_hi_local),labels=etiqueta_pct,
                              expand=ggplot2::expansion(mult=c(0,0))) +
  ggplot2::labs(title="Gráfica N° 3: Frecuencia relativa (hᵢ) local",
                x="Región",y="Frecuencia relativa (%)",caption=fuente_graficas) +
  tema_barras

5.4 Gráfica N° 4 — Frecuencia relativa (hᵢ) global

ggplot2::ggplot(tabla_global, ggplot2::aes(x=Region,y=hi)) +
  ggplot2::geom_col(fill="#286492",color="#244861",width=.72,linewidth=.36) +
  ggplot2::geom_text(ggplot2::aes(label=sprintf("%.2f%%",100*hi)),vjust=-.48,
                     size=4.3,fontface="bold",color="#15364C") +
  escala_regiones +
  ggplot2::scale_y_continuous(limits=c(0,limite_hi_global),
                              breaks=seq(0,1,by=.2),labels=etiqueta_pct,
                              expand=ggplot2::expansion(mult=c(0,0))) +
  ggplot2::labs(title="Gráfica N° 4: Frecuencia relativa (hᵢ) global",
                x="Región",y="Frecuencia relativa (%)",caption=fuente_graficas) +
  tema_barras

5.5 Gráfica N° 5 — Gráfica Circular Porcentual

leyenda <- paste0(stringr::str_wrap(as.character(tabla_local$Region),width=23),
                  "  —  ",sprintf("%.2f%%",tabla_local$porcentaje))
ggplot2::ggplot(tabla_local,ggplot2::aes(x=1,y=ni,fill=Region)) +
  ggplot2::geom_col(width=1,color="#244861",linewidth=.48) +
  ggplot2::coord_polar(theta="y",start=0) +
  ggplot2::scale_fill_manual(values=colores,labels=leyenda) +
  ggplot2::labs(title="Gráfica N° 5: Distribución porcentual según la región",
                fill="Región — porcentaje",caption=fuente_graficas) +
  ggplot2::theme_void(base_size=15) +
  ggplot2::theme(
    plot.title=ggplot2::element_text(hjust=.5,face="bold",size=17,color="#15364C"),
    legend.position="right",
    legend.title=ggplot2::element_text(face="bold",size=13,color="#15364C"),
    legend.text=ggplot2::element_text(size=12,color="#253B4B",lineheight=1.05),
    legend.key.size=grid::unit(.56,"cm"),
    plot.caption=ggplot2::element_text(hjust=0,face="italic",size=10.5,
                                      color="#546775",margin=ggplot2::margin(t=14)),
    plot.margin=ggplot2::margin(18,30,25,24)
  )

6 Tabla de Indicadores

cat(crear_indicadores())
Cuadro N° 2: Indicadores estadísticos de REGION (Región), Nueva York, 1860 - 2026
Variable
Tendencia central
Dispersión
Forma
Valores atípicos
VARIABLE ANALIZADA Media (X̄) Mediana (Me) Moda (Mo) Desviación estándar (Sd) Coeficiente de variación (CV %) Asimetría (As) Curtosis (K) Valores atípicos (Outliers)
REGION (Región) N/A N/A 9 N/A N/A N/A N/A N/A

N/A: No aplicable a una variable cualitativa nominal.

Registros válidos (N): 47.492   |   Categorías: 9   |   Frecuencia modal: 40.003   |   Porcentaje modal: 84.23%.

Fuente: Oil, Gas & Other Regulated Wells: Beginning 1860.

7 Conclusión

La variable REGION (Región) es cualitativa nominal y presenta 9 categorías en 47.492 registros válidos. La moda corresponde a 9, con una frecuencia de 40.003 pozos (84.23% del total), lo que evidencia una concentración de los registros en determinadas regiones del estado de Nueva York.

Autor: Jennifer Cordones | Análisis Estadístico — Oil, Gas & Other Regulated Wells - NY State