1: Carga de datos

library(readxl)
Produccio_n_Campo_Sacha_csv <- read_excel("Producción Campo Sacha.csv.xlsx")
View(Produccio_n_Campo_Sacha_csv)
str(Produccio_n_Campo_Sacha_csv)
## tibble [8,344 × 31] (S3: tbl_df/tbl/data.frame)
##  $ mes                   : chr [1:8344] "Ene" "Ene" "Ene" "Ene" ...
##  $ día                   : num [1:8344] 1 1 1 1 1 1 1 1 1 1 ...
##  $ Pozo                  : chr [1:8344] "SACHA-001A" "SACHA-019A" "SACHA-052B" "SACHA-083A" ...
##  $ Campo                 : chr [1:8344] "SACHA" "SACHA" "SACHA" "SACHA" ...
##  $ Reservorio            : chr [1:8344] "U" "U" "U INFERIOR" "HOLLIN INFERIOR" ...
##  $ Bpd                   : num [1:8344] NA 53 249 139 186 136 NA 456 161 164 ...
##  $ Bppd_BH               : num [1:8344] 159 NA NA NA NA NA 155 NA NA NA ...
##  $ Bfpd_BE               : num [1:8344] NA 534 346 1158 1163 ...
##  $ Bfpd_BH               : num [1:8344] 695 NA NA NA NA NA 441 NA NA NA ...
##  $ Bapd_BE               : num [1:8344] NA 481 97 1019 977 ...
##  $ Bapd_BH               : num [1:8344] 536 NA NA NA NA NA 286 NA NA NA ...
##  $ Bsw_BE                : num [1:8344] NA 90.1 28 88 84 ...
##  $ Bsw_BH                : num [1:8344] 77.1 NA NA NA NA ...
##  $ Api_BE                : num [1:8344] NA 26.7 27.8 27.7 24 20.5 NA 28.5 29.9 26.3 ...
##  $ Api_BH                : num [1:8344] 27.8 NA NA NA NA NA 23.2 NA NA NA ...
##  $ Gas_BE                : num [1:8344] NA 10.76 50.55 1.11 27.9 ...
##  $ Gas_BH                : num [1:8344] 32.3 NA NA NA NA ...
##  $ Salinidad_BE          : num [1:8344] NA 15920 30227 1600 13000 ...
##  $ Salinidad_BH          : num [1:8344] 10800 NA NA NA NA NA 3800 NA NA NA ...
##  $ Rgl_BE                : num [1:8344] NA 20.15 146.1 0.96 23.99 ...
##  $ Rgl_BH                : num [1:8344] 46.5 NA NA NA NA ...
##  $ Gor_BE                : num [1:8344] NA 203.02 203.01 7.99 150 ...
##  $ Gor_BH                : num [1:8344] 203 NA NA NA NA ...
##  $ Horas_BE              : num [1:8344] NA 4 5 4 4 10 NA 4 10 10 ...
##  $ Horas_BH              : num [1:8344] 4 NA NA NA NA NA 4 NA NA NA ...
##  $ Bomba_BE              : chr [1:8344] NA "SF-320|SF-320|SF-900|SFGH2500/520/180/9259" "RC 1000|RC 1000|RC 1000/300/120/9250" "P23/68/30/7000" ...
##  $ Bomba_BH              : chr [1:8344] "JET  12K/0//0" NA NA NA ...
##  $ Frecuencia Operaciones: num [1:8344] NA 65 62 46 59 52 NA 58.5 57 54 ...
##  $ Voltaje               : num [1:8344] NA 479 457 364 440 452 NA 475 455 439 ...
##  $ Amperaje              : num [1:8344] NA 29 35 14 59 30 NA 23 35 34 ...
##  $ Presión Intake        : num [1:8344] NA 484 406 0 345 162 NA 546 338 0 ...
# 1 Extraer la variable continua
presion_intake <- Produccio_n_Campo_Sacha_csv$`Presión Intake`  
presion_intake <- as.numeric(presion_intake)
presion_intake <- na.omit(presion_intake)

2 Tabla de distribución de frecuencias

2.1 Sturges

Creación de la tabla de distribución de frecuencia

k <- 1 + (3.3 * log10(length(presion_intake)))  
k <- floor(k)

min <- min(presion_intake)  
max <- max(presion_intake)  
R <- max - min
A <- R / k

# Líneas EXACTAS del ejemplo del enlace:
Li <- round(seq(from = min, to = max - A, by = A), 4)
Ls <- round(seq(from = min + A, to = max, by = A), 4)

MC <- round((Li + Ls) / 2, 2)

ni <- numeric(length(Li))
for (i in 1:length(Li)) {
  ni[i] <- sum(presion_intake >= Li[i] & presion_intake < Ls[i])  
}
ni[length(Li)] <- sum(presion_intake >= Li[length(Li)] & presion_intake <= max)  

cat("Suma de ni =", sum(ni), "\n")
## Suma de ni = 7705
hi <- ni / sum(ni) * 100
cat("Suma de hi =", sum(hi), "\n")
## Suma de hi = 100
Niasc <- cumsum(ni)
Nidsc <- rev(cumsum(rev(ni)))
Hiasc <- round(cumsum(hi))
Hidsc <- round(rev(cumsum(rev(hi))))

TDFPresionIntake <- data.frame(Li, Ls, MC, ni, hi, Niasc, Nidsc, Hiasc, Hidsc)
library(gt)
library(dplyr)
## 
## Adjuntando el paquete: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
tabla1_sturges <- TDFPresionIntake %>%  
  gt() %>%
  tab_header(
    title = md("*Tabla 1: Distribución de Frecuencias*"),
    subtitle = md("**Método Sturges - Variable: Presión Intake**")  
  ) %>%
  tab_source_note(
    source_note = md("Campo Sacha")
  ) %>%
  cols_label(
    Li = "L. Inferior",
    Ls = "L. Superior",
    MC = "Marca Clase",
    ni = "Frec. Abs.",
    hi = "Frec. Rel. %",
    Niasc = "Ni Asc.",
    Nidsc = "Ni Desc.",
    Hiasc = "Hi Asc. %",
    Hidsc = "Hi Desc. %"
  ) %>%
  fmt_number(
    columns = c(Li, Ls, MC),
    decimals = 2
  ) %>%
  fmt_number(
    columns = c(hi),
    decimals = 2,
    pattern = "{x}%"
  )

cat("\n=== TABLA 1: MÉTODO STURGES ===\n")
## 
## === TABLA 1: MÉTODO STURGES ===
tabla1_sturges
Tabla 1: Distribución de Frecuencias
Método Sturges - Variable: Presión Intake
L. Inferior L. Superior Marca Clase Frec. Abs. Frec. Rel. % Ni Asc. Ni Desc. Hi Asc. % Hi Desc. %
0.00 277.62 138.81 3817 49.54% 3817 7705 50 100
277.62 555.23 416.42 2503 32.49% 6320 3888 82 50
555.23 832.85 694.04 582 7.55% 6902 1385 90 18
832.85 1,110.46 971.65 156 2.02% 7058 803 92 10
1,110.46 1,388.08 1,249.27 112 1.45% 7170 647 93 8
1,388.08 1,665.69 1,526.88 143 1.86% 7313 535 95 7
1,665.69 1,943.31 1,804.50 89 1.16% 7402 392 96 5
1,943.31 2,220.92 2,082.12 107 1.39% 7509 303 97 4
2,220.92 2,498.54 2,359.73 80 1.04% 7589 196 98 3
2,498.54 2,776.15 2,637.35 48 0.62% 7637 116 99 2
2,776.15 3,053.77 2,914.96 43 0.56% 7680 68 100 1
3,053.77 3,331.38 3,192.58 23 0.30% 7703 25 100 0
3,331.38 3,609.00 3,470.19 2 0.03% 7705 2 100 0
Campo Sacha

Tabla de distribución

total_ni <- sum(TDFPresionIntake$ni)  
total_hi <- 100

TDFPresionIntakeCompleto <- rbind( 
  TDFPresionIntake,  
  data.frame(
    Li = " Total", 
    Ls = " ", 
    MC = " ",
    ni = total_ni, 
    hi = total_hi, 
    Niasc = " ", 
    Nidsc = " ", 
    Hiasc = " ", 
    Hidsc = " "
  )
)

TABLA 2 FORMATEADA: Con Total (TDFPresionIntakeCompleto)

tabla2_con_total <- TDFPresionIntakeCompleto %>%  
  gt() %>%
  tab_header(
    title = md("*Tabla 2: Distribución Completa*"),
    subtitle = md("**Variable: Presión Intake - Con Total**")  
  ) %>%
  tab_source_note(
    source_note = md("Fuente: Producción Campo Sacha")
  ) %>%
  tab_style(
    style = cell_text(weight = "bold"),
    locations = cells_body(rows = Li == " Total")
  ) %>%
  cols_label(
    Li = "L. Inferior",
    Ls = "L. Superior",
    MC = "Marca Clase",
    ni = "Frec. Abs.",
    hi = "Frec. Rel. %",
    Niasc = "Ni Asc.",
    Nidsc = "Ni Desc.",
    Hiasc = "Hi Asc. %",
    Hidsc = "Hi Desc. %"
  )

cat("\n=== TABLA 2: CON FILA DE TOTAL ===\n")
## 
## === TABLA 2: CON FILA DE TOTAL ===
tabla2_con_total
Tabla 2: Distribución Completa
Variable: Presión Intake - Con Total
L. Inferior L. Superior Marca Clase Frec. Abs. Frec. Rel. % Ni Asc. Ni Desc. Hi Asc. % Hi Desc. %
0 277.6154 138.81 3817 49.53926022 3817 7705 50 100
277.6154 555.2308 416.42 2503 32.48539909 6320 3888 82 50
555.2308 832.8462 694.04 582 7.55353666 6902 1385 90 18
832.8462 1110.4615 971.65 156 2.02465931 7058 803 92 10
1110.4615 1388.0769 1249.27 112 1.45360156 7170 647 93 8
1388.0769 1665.6923 1526.88 143 1.85593770 7313 535 95 7
1665.6923 1943.3077 1804.5 89 1.15509409 7402 392 96 5
1943.3077 2220.9231 2082.12 107 1.38870863 7509 303 97 4
2220.9231 2498.5385 2359.73 80 1.03828683 7589 196 98 3
2498.5385 2776.1538 2637.35 48 0.62297210 7637 116 99 2
2776.1538 3053.7692 2914.96 43 0.55807917 7680 68 100 1
3053.7692 3331.3846 3192.58 23 0.29850746 7703 25 100 0
3331.3846 3609 3470.19 2 0.02595717 7705 2 100 0
Total 7705 100.00000000
Fuente: Producción Campo Sacha

2.2 Intervalos con R

Histograma de la variable

histo_PresionIntake <- hist(presion_intake, 
                             main = "Gráfica: Distribución de la Presión Intake\nCampo Sacha",  
                             xlab = "Presión Intake",  
                             ylab = "Cantidad", 
                             col = "lightblue",
                             border = "darkblue",
                             las = 1)

#### Creación de la tabla de distribución de frecuencia

Limites <- histo_PresionIntake$breaks  
LimInf <- Limites[1:(length(Limites)-1)]
LimSup <- Limites[2:length(Limites)]
Mc <- histo_PresionIntake$mids  
ni_R <- histo_PresionIntake$counts  

cat("\nSuma de ni (R automático) =", sum(ni_R), "\n")
## 
## Suma de ni (R automático) = 7705
hi_R <- ni_R / sum(ni_R) * 100
cat("Suma de hi (R automático) =", sum(hi_R), "\n")
## Suma de hi (R automático) = 100
Ni_asc <- cumsum(ni_R)
Ni_dsc <- rev(cumsum(rev(ni_R)))
Hi_asc <- round(cumsum(hi_R), 2) 
Hi_dsc <- round(rev(cumsum(rev(hi_R))), 2)

TDF_PresionIntake_R <- data.frame(LimInf, LimSup, Mc, ni_R,hi_R,  
                                  Ni_asc, Ni_dsc, Hi_asc,Hi_dsc)

Creación de la tabla de distribución de frecuencia

 tabla3_R_auto <- TDF_PresionIntake_R %>%  
  gt() %>%
  tab_header(
    title = md("*Tabla 3: Distribución - Intervalos R*"),
    subtitle = md("**Método Automático de R - Variable: Presión Intake**")  
  ) %>%
  tab_source_note(
    source_note = md("Intervalos generados automáticamente por hist()")
  ) %>%
  cols_label(
    LimInf = "L. Inferior",
    LimSup = "L. Superior",
    Mc = "Marca Clase",
    ni_R = "Frec. Abs.",
    hi_R = "Frec. Rel. %",
    Ni_asc = "Ni Asc.",
    Ni_dsc = "Ni Desc.",
    Hi_asc = "Hi Asc. %",
    Hi_dsc = "Hi Desc. %"
  ) %>%
  fmt_number(
    columns = c(hi_R, Hi_asc, Hi_dsc),
    decimals = 2,
    pattern = "{x}%"
  )

cat("\n=== TABLA 3: INTERVALOS AUTOMÁTICOS DE R ===\n")
## 
## === TABLA 3: INTERVALOS AUTOMÁTICOS DE R ===
tabla3_R_auto
Tabla 3: Distribución - Intervalos R
Método Automático de R - Variable: Presión Intake
L. Inferior L. Superior Marca Clase Frec. Abs. Frec. Rel. % Ni Asc. Ni Desc. Hi Asc. % Hi Desc. %
0 200 100 2456 31.88% 2456 7705 31.88% 100.00%
200 400 300 3064 39.77% 5520 5249 71.64% 68.12%
400 600 500 959 12.45% 6479 2185 84.09% 28.36%
600 800 700 382 4.96% 6861 1226 89.05% 15.91%
800 1000 900 149 1.93% 7010 844 90.98% 10.95%
1000 1200 1100 85 1.10% 7095 695 92.08% 9.02%
1200 1400 1300 87 1.13% 7182 610 93.21% 7.92%
1400 1600 1500 124 1.61% 7306 523 94.82% 6.79%
1600 1800 1700 78 1.01% 7384 399 95.83% 5.18%
1800 2000 1900 32 0.42% 7416 321 96.25% 4.17%
2000 2200 2100 90 1.17% 7506 289 97.42% 3.75%
2200 2400 2300 77 1.00% 7583 199 98.42% 2.58%
2400 2600 2500 17 0.22% 7600 122 98.64% 1.58%
2600 2800 2700 39 0.51% 7639 105 99.14% 1.36%
2800 3000 2900 19 0.25% 7658 66 99.39% 0.86%
3000 3200 3100 41 0.53% 7699 47 99.92% 0.61%
3200 3400 3300 5 0.06% 7704 6 99.99% 0.08%
3400 3600 3500 0 0.00% 7704 1 99.99% 0.01%
3600 3800 3700 1 0.01% 7705 1 100.00% 0.01%
Intervalos generados automáticamente por hist()

Tabla de distribución

total_ni_R <- sum(TDF_PresionIntake_R$ni_R)  
total_hi_R <- 100  

# Crear tabla con Total
TDF_PresionIntake_R_Completo <- rbind(  
  TDF_PresionIntake_R,  
  data.frame(
    LimInf = "Total",
    LimSup = " ", 
    Mc = " ",
    ni_R = total_ni_R,
    hi_R = total_hi_R, 
    Ni_asc = " ", 
    Ni_dsc = " ", 
    Hi_asc = " ", 
    Hi_dsc = " "
  )
)

library(gt)
library(dplyr)

tabla_PresionIntake_Final <- TDF_PresionIntake_R_Completo %>%  
  gt() %>%
  tab_header(
    title = md("*Tabla de Distribución de Frecuencias*"),
    subtitle = md("**Variable: Presión Intake - Campo Sacha**")  
  )

# Mostrar
tabla_PresionIntake_Final
Tabla de Distribución de Frecuencias
Variable: Presión Intake - Campo Sacha
LimInf LimSup Mc ni_R hi_R Ni_asc Ni_dsc Hi_asc Hi_dsc
0 200 100 2456 31.87540558 2456 7705 31.88 100
200 400 300 3064 39.76638546 5520 5249 71.64 68.12
400 600 500 959 12.44646334 6479 2185 84.09 28.36
600 800 700 382 4.95781960 6861 1226 89.05 15.91
800 1000 900 149 1.93380921 7010 844 90.98 10.95
1000 1200 1100 85 1.10317975 7095 695 92.08 9.02
1200 1400 1300 87 1.12913692 7182 610 93.21 7.92
1400 1600 1500 124 1.60934458 7306 523 94.82 6.79
1600 1800 1700 78 1.01232966 7384 399 95.83 5.18
1800 2000 1900 32 0.41531473 7416 321 96.25 4.17
2000 2200 2100 90 1.16807268 7506 289 97.42 3.75
2200 2400 2300 77 0.99935107 7583 199 98.42 2.58
2400 2600 2500 17 0.22063595 7600 122 98.64 1.58
2600 2800 2700 39 0.50616483 7639 105 99.14 1.36
2800 3000 2900 19 0.24659312 7658 66 99.39 0.86
3000 3200 3100 41 0.53212200 7699 47 99.92 0.61
3200 3400 3300 5 0.06489293 7704 6 99.99 0.08
3400 3600 3500 0 0.00000000 7704 1 99.99 0.01
3600 3800 3700 1 0.01297859 7705 1 100 0.01
Total 7705 100.00000000

3 Histogramas

3.1 Histograma de frecuencia absoluta local (ni)

hist(presion_intake, 
     breaks = seq(min, max, A),  # Usar TUS intervalos calculados
     main = "Gráfica: Frecuencia de la Presión Intake\n(Campo Sacha - Intervalos propios)", 
     col = "blue", 
     xlab = "Presión Intake",  
     ylab = "Cantidad (ni)",
     right = FALSE)  # Para que sea [Li, Ls)

3.2 Histograma de frecuencia absoluta global (ni)

hist(presion_intake, 
     breaks = seq(min, max, A),
     main = "Gráfica: Frecuencia de la Presión Intake\n(Campo Sacha - Global)",  
     col = "blue", 
     xlab = "Presión Intake",
     ylab = "Cantidad", 
     ylim = c(0, length(presion_intake)))  # length(presion_intake) = tu n total 

3.3 Histograma de porcentaje local (hi)

 barplot(TDFPresionIntake$hi,  # Tus frecuencias relativas (%)
        space = 0,  # Sin espacio entre barras
        col = "blue", 
        xlab = "Marca de Clase (MC)", 
        ylab = "Porcentaje (%)", 
        names.arg = TDFPresionIntake$MC)  # Nombres = Marcas de clase

3.4 Histograma de porcentaje global (hi)

barplot(TDFPresionIntake$hi, 
        space = 0,
        main = "Gráfica: Porcentaje de la Presión Intake\n(Campo Sacha - Global)",  
        col = "blue", 
        xlab = "Marca de Clase (MC)", 
        ylab = "Porcentaje (%)",
        names.arg = TDFPresionIntake$MC,  
        ylim = c(0, 100))  # Fijar eje Y de 0 a 100%

4 Diagramas

4.1 Ojivas

4.1.1 Ojivas combinadas (ni)

plot(TDFPresionIntake$Ls, TDFPresionIntake$Nidsc,
     type = "o",  # "o" = puntos con líneas
     xlim = c(0, max),  # Eje X desde 0 hasta máximo
     main = "Gráfica: Ojivas combinadas de la Presión Intake\n(Campo Sacha)", 
     ylab = "Frecuencia Acumulada", 
     col = "blue", 
     xlab = "Presión Intake",  
     pch = 16)

# Agregar ojiva ascendente
lines(TDFPresionIntake$Li, TDFPresionIntake$Niasc, 
      col = "black", 
      type = "b",  # "b" = puntos con líneas (pero discontinuas)
      pch = 16)

# Leyenda
legend("right",
       legend = c("Ojiva descendente (Nidsc)", "Ojiva ascendente (Niasc)"),
       col = c("blue", "black"), 
       pch = 16,
       lty = 1,
       cex = 0.8)

#### 4.1.2 Ojivas combinadas (hi) - Porcentajes

# Gráfico principal (ojiva descendente - porcentajes)
plot(TDFPresionIntake$Ls, TDFPresionIntake$Hidsc,  
     type = "o",  # "o" = puntos y líneas
     xlim = c(0, max),
     main = "Gráfica: Ojivas combinadas de la Presión Intake\n(Campo Sacha - Porcentajes)",  
     ylab = "Porcentaje Acumulado (%)", 
     col = "blue", 
     xlab = "Presión Intake",  
     ylim = c(0, 100))  # Porcentajes de 0 a 100%

# Agregar ojiva ascendente (porcentajes) - SIN "add=TRUE"
lines(TDFPresionIntake$Li, TDFPresionIntake$Hiasc,  
      col = "black", 
      type = "b")  # "b" = puntos con líneas discontinuas

# Leyenda
legend("right",
       legend = c("Ojiva descendente (Hidsc)", "Ojiva ascendente (Hiasc)"),
       col = c("blue", "black"), 
       pch = 1,  # Tipo de punto
       lty = 1,  # Tipo de línea
       cex = 0.7)  # Tamaño de texto

### 4.2 Diagrama de caja (Boxplot)

boxplot(presion_intake,
        horizontal = TRUE,  # Horizontal (como el ejemplo)
        col = "blue", 
        main = "Gráfica: Distribución de la Presión Intake\n(Campo Sacha)",  
        xlab = "Presión Intake", 
        notch = FALSE)  # Sin muesca

## 5: Resumen y outliers

# Resumen
summary(presion_intake)  
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##     0.0   184.0   280.0   430.4   438.0  3609.0
# Identificar outliers
outliers <- boxplot.stats(presion_intake)$out  
num_outliers <- length(outliers) 
min_outliers <- min(outliers)
max_outliers <- max(outliers)

cat("Número de outliers:", num_outliers, "\n")
## Número de outliers: 822
if(num_outliers > 0) {
  cat("Mínimo outlier:", min_outliers, "\n")
  cat("Máximo outlier:", max_outliers, "\n")
}
## Mínimo outlier: 820 
## Máximo outlier: 3609

5:Indicadores estadísticos

5.1: Extraer la variable continua

# Media aritmética
x <- mean(presion_intake)  

# Mediana 
Me <- median(presion_intake) 

# Mínimo y máximo
ri <- min(presion_intake)  
rs <- max(presion_intake)  

# Mostrar resultados
cat("Media aritmética (x) =", x, "\n")
## Media aritmética (x) = 430.4465
cat("Mediana (Me) =", Me, "\n")
## Mediana (Me) = 280
cat("Mínimo (ri) =", ri, "\n")
## Mínimo (ri) = 0
cat("Máximo (rs) =", rs, "\n")
## Máximo (rs) = 3609

5.2 Dispersión

# Varianza
varianza <- var(presion_intake)  
cat("Varianza =", varianza, "\n")
## Varianza = 272157
# Desviación estándar
s <- sd(presion_intake) 
cat("Desviación estándar (s) =", s, "\n")
## Desviación estándar (s) = 521.6867
# Coeficiente de variación
CV <- (s / x) * 100
cat("Coeficiente de variación (CV) =", CV, "%\n")
## Coeficiente de variación (CV) = 121.1966 %
# 5.3 Forma 
library(e1071)

# Coeficiente de asimetría
As <- skewness(presion_intake)  

# Coeficiente de kurtosis  
k <- kurtosis(presion_intake) 

cat("Coeficiente de asimetría =", As, "\n")
## Coeficiente de asimetría = 2.857732
cat("Coeficiente de kurtosis =", k, "\n")
## Coeficiente de kurtosis = 8.790436

6: Tabla resumen

# 6 Tabla resumen 
Variable <- c("Presión Intake") 

TablaIndicadores <- data.frame(
  Variable,
  ri,                    # mínimo
  rs,                    # máximo  
  round(x, 2),           # media (x)
  Me,                    # mediana (Me)
  round(s, 2),           # desviación estándar (sd)
  round(CV, 2),          # coeficiente de variación (%)
  round(As, 2),          # asimetría (As)
  round(k, 2)            # kurtosis (K)
)

colnames(TablaIndicadores) <- c("Variable", "minimo", "máximo", "x", 
                                "Me", "sd", "Cv (%)", "As", "K")

library(gt)

tabla_resumen_gt <- TablaIndicadores %>%
  gt() %>%
  tab_header(
    title = md("*Tabla: Indicadores estadísticos*"),
    subtitle = md("**Variable: Presión Intake**")  
  ) %>%
  tab_source_note(
    source_note = md("Campo Sacha")
  ) %>%
  tab_options(
    table.border.top.color = "black",
    table.border.bottom.color = "black",
    heading.border.bottom.color = "black",
    heading.border.bottom.width = px(2)
  ) %>%
  fmt_number(
    columns = c("minimo", "máximo", "x", "Me", "sd", "Cv (%)", "As", "K"),
    decimals = 2
  ) %>%
  fmt_number(
    columns = "Cv (%)",
    pattern = "{x}%"
  )

# Mostrar tabla
tabla_resumen_gt
Tabla: Indicadores estadísticos
Variable: Presión Intake
Variable minimo máximo x Me sd Cv (%) As K
Presión Intake 0.00 3,609.00 430.45 280.00 521.69 121.20% 2.86 8.79
Campo Sacha

6.1:Outliers

# 1. Crear tabla 
TablaOutliers <- data.frame(
  Outliers = num_outliers,
  Mínimo = ifelse(num_outliers > 0, min_outliers, NA),
  Máximo = ifelse(num_outliers > 0, max_outliers, NA)
)

library(gt)

tabla_outliers_final <- TablaOutliers %>%
  gt() %>%
  tab_header(
    title = "Outliers - Presión Intake", 
    subtitle = "Campo Sacha"
  )

# 3. Mostrar
tabla_outliers_final
Outliers - Presión Intake
Campo Sacha
Outliers Mínimo Máximo
822 820 3609

7: CONCLUSIÓN

# El análisis de Presión Intake en Campo Sacha muestra:
# - Rango: 0 a 3,609 unidades
# - Media: 430.45, Mediana: 280.00
# - CV: 121.20% (variabilidad EXTREMA)
# - 822 outliers (51% de datos atípicos)
# - Asimetría: 2.86 (sesgo positivo fuerte)
#
# Estos indicadores sugieren operación con alta variabilidad y presencia
# significativa de valores extremos. Se recomienda revisar instrumentación
# para verificar validez de mediciones extremas (0 y >3,000 unidades).