datos_originales <- readr::read_delim(
ruta, delim=delimitador, trim_ws=TRUE, show_col_types=FALSE,
name_repair="minimal", col_types=readr::cols(.default=readr::col_character())
)
## Carga exitosa: 47.501 registros.
completacion_limpia <- datos_originales |>
dplyr::transmute(Completacion=stringr::str_squish(as.character(.data[[columna_completion]]))) |>
dplyr::filter(!is.na(Completacion), Completacion != "",
!toupper(Completacion) %in% c("NA", "N/A", "NULL"))
N <- nrow(completacion_limpia)
if (N == 0L) stop("No hay registros válidos de COMPLETION.")
k_completaciones <- dplyr::n_distinct(completacion_limpia$Completacion)
cat("Registros válidos:", fmt_entero(N),
" | Categorías distintas de Completion:", fmt_entero(k_completaciones), "\n")
## Registros válidos: 47.501 | Categorías distintas de Completion: 6
| VARIABLE | TIPO | ESCALA DE MEDICIÓN | UNIDAD DE ANÁLISIS | CATEGORÍAS (k) | REGISTROS VÁLIDOS (N) |
|---|---|---|---|---|---|
| COMPLETION (Completación del pozo) | Cualitativa nominal | Nominal | Pozo regulado | 6 | 47.501 |
cat(crear_cuadro(tabla_frecuencias, 1,
"Distribución de frecuencias de los pozos regulados según la completación del pozo, Nueva York, 1860 - 2026",
desplazamiento=(k_completaciones > 15L)))
| COMPLETACIÓN DEL POZO | FRECUENCIA ABSOLUTA (nᵢ) | FRECUENCIA RELATIVA (hᵢ) | FRECUENCIA RELATIVA PORCENTUAL (%) |
|---|---|---|---|
| 4 | 1 | 0.0000 | 0.00% |
| 0 | 46.791 | 0.9851 | 98.51% |
| 9 | 1 | 0.0000 | 0.00% |
| 1 | 635 | 0.0134 | 1.34% |
| 3 | 3 | 0.0001 | 0.01% |
| 2 | 70 | 0.0015 | 0.15% |
| TOTAL | 47.501 | 1.0000 | 100.00% |
Fuente: Oil, Gas & Other Regulated Wells: Beginning 1860.
Interpretación: la categoría de completación con mayor frecuencia es 0, con 46.791 pozos (98.51% del total). La frecuencia mínima es de 1 pozos, compartida por 2 categorías.
# 11 a 20 categorías: Top 6 + Otras. Más de 20: Top 10 + Otras.
if (usar_resumen) {
cat("## Top ", numero_top, " de categorías con mayor frecuencia absoluta {-}\n\n", sep="")
cat("El Cuadro N° 2 presenta las ", numero_top,
" categorías de completación más frecuentes, de mayor a menor, ",
"y agrupa las restantes en Otras completaciones (al final). ",
"El Top ", numero_top, " reúne el ", sprintf("%.2f%%", pct_top),
" de los ", fmt_entero(N), " registros válidos.\n\n", sep="")
cat(crear_cuadro(tabla_resumen, 2,
paste0("Distribución de frecuencias de los pozos regulados: Top ", numero_top,
" de completaciones y Otras, Nueva York, 1860 - 2026")))
}
ggplot2::ggplot(tabla_local, ggplot2::aes(x=Completacion,y=ni,fill=Completacion)) +
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_completaciones +
ggplot2::scale_y_continuous(limits=c(0,limite_ni_local),
labels=fmt_entero,
expand=ggplot2::expansion(mult=c(0,0))) +
ggplot2::coord_cartesian(clip="off") +
ggplot2::labs(title="Gráfica N° 1: Frecuencia absoluta (nᵢ) local",
x="Completación del pozo",y="Frecuencia absoluta (nᵢ)",caption=fuente_graficas) +
tema_barras
ggplot2::ggplot(tabla_global, ggplot2::aes(x=Completacion,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_completaciones +
ggplot2::scale_y_continuous(limits=c(0,limite_ni_global),
labels=fmt_entero,
expand=ggplot2::expansion(mult=c(0,0))) +
ggplot2::coord_cartesian(clip="off") +
ggplot2::labs(title="Gráfica N° 2: Frecuencia absoluta (nᵢ) global",
x="Completación del pozo",y="Frecuencia absoluta (nᵢ)",caption=fuente_graficas) +
tema_barras
ggplot2::ggplot(tabla_local, ggplot2::aes(x=Completacion,y=hi,fill=Completacion)) +
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_completaciones +
ggplot2::scale_y_continuous(limits=c(0,limite_hi_local),labels=etiqueta_pct,
expand=ggplot2::expansion(mult=c(0,0))) +
ggplot2::coord_cartesian(clip="off") +
ggplot2::labs(title="Gráfica N° 3: Frecuencia relativa (hᵢ) local",
x="Completación del pozo",y="Frecuencia relativa (%)",caption=fuente_graficas) +
tema_barras
ggplot2::ggplot(tabla_global, ggplot2::aes(x=Completacion,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_completaciones +
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::coord_cartesian(clip="off") +
ggplot2::labs(title="Gráfica N° 4: Frecuencia relativa (hᵢ) global",
x="Completación del pozo",y="Frecuencia relativa (%)",caption=fuente_graficas) +
tema_barras
leyenda <- paste0(stringr::str_wrap(as.character(tabla_local$Completacion),width=23),
" — ",sprintf("%.2f%%",tabla_local$porcentaje))
ggplot2::ggplot(tabla_local,ggplot2::aes(x=1,y=ni,fill=Completacion)) +
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 completación del pozo",
fill="Completación del pozo — 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) |
|---|---|---|---|---|---|---|---|---|
| COMPLETION (Completación del pozo) | N/A | N/A | 0 | N/A | N/A | N/A | N/A | N/A |
N/A: No aplicable a una variable cualitativa nominal.
Registros válidos (N): 47.501 | Categorías: 6 | Frecuencia modal: 46.791 | Porcentaje modal: 98.51%.
Fuente: Oil, Gas & Other Regulated Wells: Beginning 1860.
La variable COMPLETION (Completación del pozo) es cualitativa nominal y presenta 6 categorías en 47.501 registros válidos. La moda corresponde a 0, con una frecuencia de 46.791 pozos (98.51% del total), lo que evidencia una concentración de registros en determinadas categorías de completación de los pozos regulados del estado de Nueva York.
Autor: Jennifer Cordones | Análisis Estadístico — Oil, Gas & Other Regulated Wells - NY State