datos_originales <- readr::read_delim(ruta, delim=delimitador, trim_ws=TRUE, show_col_types=FALSE, name_repair="minimal")
## Carga exitosa: 47.501 registros.
county_limpio <- datos_originales |>
dplyr::transmute(Condado=stringr::str_squish(as.character(.data[[columna_county]]))) |>
dplyr::filter(!is.na(Condado), Condado != "", !toupper(Condado) %in% c("NA", "N/A", "NULL"))
set.seed(2026)
county_limpio$Condado <- factor(county_limpio$Condado,
levels=sample(unique(county_limpio$Condado)))
N <- nrow(county_limpio)
if (length(levels(county_limpio$Condado)) != 56L) {
stop("El archivo contiene ", length(levels(county_limpio$Condado)),
" categorías válidas de County y se esperaban 56. ",
"Comprueba la ruta y que no hayas filtrado el CSV.")
}
cat("Registros válidos:", fmt_entero(N),
" | Condados distintos:", nlevels(county_limpio$Condado), "\n")
## Registros válidos: 47.477 | Condados distintos: 56
| VARIABLE | TIPO | ESCALA DE MEDICIÓN | UNIDAD DE ANÁLISIS | CATEGORÍAS (k) | REGISTROS VÁLIDOS (N) |
|---|---|---|---|---|---|
| County (Condado) | Cualitativa nominal | Nominal | Pozo regulado | 56 | 47.477 |
El Cuadro N° 1 presenta la frecuencia absoluta (nᵢ), la frecuencia relativa (hᵢ) y el porcentaje de pozos regulados de cada uno de los 56 condados, sobre un total de 47.477 registros válidos. Desplázate dentro de la tabla para ver todas las categorías.
cat(crear_cuadro(tabla_frecuencias, 1,
"Distribución de frecuencias de los pozos regulados según el Condado en el estado de Nueva York, 1860 - 2026",
desplazamiento=TRUE))
| CONDADO | FRECUENCIA ABSOLUTA (nᵢ) | FRECUENCIA RELATIVA (hᵢ) | FRECUENCIA RELATIVA PORCENTUAL (%) |
|---|---|---|---|
| Madison | 144 | 0.0030 | 0.30% |
| Montgomery | 9 | 0.0002 | 0.02% |
| Schenectady | 2 | 0.0000 | 0.00% |
| Richmond | 2 | 0.0000 | 0.00% |
| St Lawrence | 1 | 0.0000 | 0.00% |
| Cortland | 30 | 0.0006 | 0.06% |
| Essex | 3 | 0.0001 | 0.01% |
| Rockland | 7 | 0.0001 | 0.01% |
| Clinton | 1 | 0.0000 | 0.00% |
| Steuben | 2.069 | 0.0436 | 4.36% |
| Delaware | 39 | 0.0008 | 0.08% |
| Sullivan | 3 | 0.0001 | 0.01% |
| Otsego | 20 | 0.0004 | 0.04% |
| Chenango | 201 | 0.0042 | 0.42% |
| Genesee | 880 | 0.0185 | 1.85% |
| Onondaga | 295 | 0.0062 | 0.62% |
| Washington | 3 | 0.0001 | 0.01% |
| Oswego | 213 | 0.0045 | 0.45% |
| New York | 213 | 0.0045 | 0.45% |
| Wayne | 38 | 0.0008 | 0.08% |
| Saratoga | 5 | 0.0001 | 0.01% |
| Bronx | 20 | 0.0004 | 0.04% |
| Monroe | 32 | 0.0007 | 0.07% |
| Statewide | 593 | 0.0125 | 1.25% |
| Warren | 2 | 0.0000 | 0.00% |
| Greene | 3 | 0.0001 | 0.01% |
| Tompkins | 110 | 0.0023 | 0.23% |
| Cattaraugus | 11.988 | 0.2525 | 25.25% |
| Niagara | 16 | 0.0003 | 0.03% |
| Ulster | 10 | 0.0002 | 0.02% |
| Albany | 19 | 0.0004 | 0.04% |
| Chautauqua | 6.367 | 0.1341 | 13.41% |
| Ontario | 348 | 0.0073 | 0.73% |
| Dutchess | 10 | 0.0002 | 0.02% |
| Westchester | 61 | 0.0013 | 0.13% |
| Nassau | 4 | 0.0001 | 0.01% |
| Seneca | 456 | 0.0096 | 0.96% |
| Tioga | 125 | 0.0026 | 0.26% |
| Yates | 161 | 0.0034 | 0.34% |
| Schuyler | 440 | 0.0093 | 0.93% |
| Livingston | 457 | 0.0096 | 0.96% |
| Broome | 68 | 0.0014 | 0.14% |
| Queens | 12 | 0.0003 | 0.03% |
| Cayuga | 491 | 0.0103 | 1.03% |
| Wyoming | 1.147 | 0.0242 | 2.42% |
| Orange | 21 | 0.0004 | 0.04% |
| Chemung | 234 | 0.0049 | 0.49% |
| Allegany | 16.451 | 0.3465 | 34.65% |
| Herkimer | 14 | 0.0003 | 0.03% |
| Lewis | 11 | 0.0002 | 0.02% |
| Jefferson | 13 | 0.0003 | 0.03% |
| Fulton | 5 | 0.0001 | 0.01% |
| Orleans | 30 | 0.0006 | 0.06% |
| Erie | 3.504 | 0.0738 | 7.38% |
| Schoharie | 4 | 0.0001 | 0.01% |
| Oneida | 72 | 0.0015 | 0.15% |
| Total | 47.477 | 1.0000 | 100.00% |
Fuente: Oil, Gas & Other Regulated Wells: Beginning 1860.
Interpretación: el condado con mayor número de pozos es Allegany, con 16.451 registros (34.65%), mientras que St Lawrence, Clinton presenta la menor frecuencia, con 1 registros (0.00%).
La tabla resume los 10 condados más frecuentes y agrupa los demás en Otros, conservando el total de 47.477 registros válidos. Estos 10 condados concentran el 92.56% de los pozos.
cat(crear_cuadro(tabla_resumen, 2,
"Distribución de frecuencias de los pozos regulados: 10 condados más frecuentes y Otros, Nueva York, 1860 - 2026"))
| CONDADO | FRECUENCIA ABSOLUTA (nᵢ) | FRECUENCIA RELATIVA (hᵢ) | FRECUENCIA RELATIVA PORCENTUAL (%) |
|---|---|---|---|
| Allegany | 16.451 | 0.3465 | 34.65% |
| Cattaraugus | 11.988 | 0.2525 | 25.25% |
| Chautauqua | 6.367 | 0.1341 | 13.41% |
| Erie | 3.504 | 0.0738 | 7.38% |
| Steuben | 2.069 | 0.0436 | 4.36% |
| Wyoming | 1.147 | 0.0242 | 2.42% |
| Genesee | 880 | 0.0185 | 1.85% |
| Statewide | 593 | 0.0125 | 1.25% |
| Cayuga | 491 | 0.0103 | 1.03% |
| Livingston | 457 | 0.0096 | 0.96% |
| Otros | 3.530 | 0.0744 | 7.44% |
| Total | 47.477 | 1.0000 | 100.00% |
Fuente: Oil, Gas & Other Regulated Wells: Beginning 1860.
ggplot2::ggplot(tabla_local, ggplot2::aes(x=Condado,y=ni,fill=Condado)) +
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_condados +
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="Condado",y="Frecuencia absoluta (nᵢ)",caption=fuente_graficas) +
tema_barras
ggplot2::ggplot(tabla_global, ggplot2::aes(x=Condado,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_condados +
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="Condado",y="Frecuencia absoluta (nᵢ)",caption=fuente_graficas) +
tema_barras
ggplot2::ggplot(tabla_local, ggplot2::aes(x=Condado,y=hi,fill=Condado)) +
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_condados +
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="Condado",y="Frecuencia relativa (%)",caption=fuente_graficas) +
tema_barras
ggplot2::ggplot(tabla_global, ggplot2::aes(x=Condado,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_condados +
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="Condado",y="Frecuencia relativa (%)",caption=fuente_graficas) +
tema_barras
leyenda <- paste0(stringr::str_wrap(as.character(tabla_local$Condado),width=22),
" — ",sprintf("%.2f%%",tabla_local$porcentaje))
ggplot2::ggplot(tabla_local,ggplot2::aes(x=1,y=ni,fill=Condado)) +
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 por condado",
fill="Condado — 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"),
plot.subtitle=ggplot2::element_text(hjust=.5,size=12,color="#49657A",
margin=ggplot2::margin(t=7,b=12)),
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)
)
cat(crear_indicadores())
| 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) |
|---|---|---|---|---|---|---|---|---|
| County (Condado) | N/A | N/A | Allegany | N/A | N/A | N/A | N/A | N/A |
N/A: No aplicable a una variable cualitativa nominal.
Registros válidos (N): 47.477 | Categorías: 56 | Frecuencia modal: 16.451 | Porcentaje modal: 34.65%.
Fuente: Oil, Gas & Other Regulated Wells: Beginning 1860.
La variable County (Condado) es cualitativa nominal y presenta 56 categorías en 47.477 registros válidos. La moda corresponde a Allegany, con una frecuencia de 16.451 pozos (34.65% del total), lo que evidencia una concentración de los registros en determinados condados del estado de Nueva York.
Autor: Jennifer Cordones | Análisis Estadístico — Oil, Gas & Other Regulated Wells - NY State