Dirección de los Pozos Petroleros
setwd("C:/Users/Usuario/Desktop/Nueva carpeta")
library(readxl)
library(dplyr)
library(gt)
datos <- read_excel("tabela_de_pocos_janeiro_2018.xlsx")
Se importa la base y se verifica su estructura interna.
Datos <- read.csv("Pozos brasil 2.csv", header = TRUE, sep = ";", dec = ".", fileEncoding = "Latin1")
str(Datos)
## 'data.frame': 29575 obs. of 59 variables:
## $ POCO : chr "7-RO-123HP-RJS" "1-BP-7-RJS" "7-ARGO-4H-ESS" "7-ARGO-5H-ESS" ...
## $ CADASTRO : chr "74281026087" "74281026107" "34281026170" "34281026180" ...
## $ OPERADOR : chr "Petrobras" "BP Energy" "Shell Brasil" "Shell Brasil" ...
## $ POCO_OPERADOR : chr "7RO123HPRJS" "ANU" "7ARGO4HESS" "7ARGO5HESS" ...
## $ ESTADO : chr "RJ" "RJ" "ES" "ES" ...
## $ BACIA : chr "Campos" "Campos" "Campos" "Campos" ...
## $ BLOCO : chr "" "C-M-473" "" "" ...
## $ SIG_CAMPO : chr "RO " "" "ARGO " "ARGO " ...
## $ CAMPO : chr "RONCADOR" "" "ARGONAUTA" "ARGONAUTA" ...
## $ TERRA_MAR : chr "M" "M" "M" "M" ...
## $ POCO_POS_ANP : chr "S" "S" "S" "S" ...
## $ TIPO : chr "Explotatório" "Exploratório" "Explotatório" "Explotatório" ...
## $ CATEGORIA : chr "Desenvolvimento" "Pioneiro" "Desenvolvimento" "Desenvolvimento" ...
## $ RECLASSIFICACAO : chr "PRODUTOR COMERCIAL DE PETRÓLEO" "PORTADOR DE PETRÓLEO" "ABANDONADO POR OUTRAS RAZÕES" "INDEFINIDO" ...
## $ SITUACAO : chr "PRODUTOR" "ABANDONADO POR LOGÍSTICA EXPLORATÓRIA" "ABANDONADO DEFINITIVAMENTE" "PRODUTOR" ...
## $ INICIO : chr "3/3/2012" "14/3/2012" "12/4/2012" "14/4/2012" ...
## $ TERMINO : chr "10/3/2013" "20/9/2012" "19/9/2012" "2/5/2013" ...
## $ CONCLUSAO : chr "10/3/2013" "19/10/2012" "28/9/2012" "13/5/2013" ...
## $ TITULARIDADE : chr "Público" "Público" "Público" "Público" ...
## $ LATITUDE_BASE_4C : chr "-21:57:45,630" "-23:06:09,622" "-21:08:06,801" "-21:08:12,535" ...
## $ LONGITUDE_BASE_4C : chr "-39:44:01,130" "-40:00:41,295" "-39:46:53,226" "-39:46:49,296" ...
## $ LATITUDE_BASE_DD : chr "-21,962675" "-23,10267278" "-21,1352225" "-21,13681528" ...
## $ LONGITUDE_BASE_DD : chr "-39,73364722" "-40,01147083" "-39,78145167" "-39,78036" ...
## $ DATUM_HORIZONTAL : chr "SIRGAS2000" "SIRGAS2000" "SIRGAS2000" "SIRGAS2000" ...
## $ TIPO_DE_COORDENADA_DE_BASE: chr "Definitiva" "Definitiva" "Definitiva" "Definitiva" ...
## $ DIRECAO : chr "Horizontal" "Vertical" "Horizontal" "Horizontal" ...
## $ PROFUNDIDADE_VERTICAL_M : chr "-3145,4" "6900" "2936,99" "2934,18" ...
## $ PROFUNDIDADE_SONDADOR_M : chr "4050" "6925" "3809" "4575" ...
## $ PROFUNDIDADE_MEDIDA_M : chr "4050" "6925" "3809" "4575" ...
## $ REFERENCIA_DE_PROFUNDIDADE: chr "MR" "MR" "MR" "MR" ...
## $ MESA_ROTATIVA : chr "24" "25" "24,24" "24,24" ...
## $ COTA_ALTIMETRICA_M : chr "0" "0" "0" "0" ...
## $ LAMINA_D_AGUA_M : chr "1827" "2730" "1705,84" "1705,35" ...
## $ DATUM_VERTICAL : chr "NM" "NM" "NM" "NM" ...
## $ UNIDADE_ESTRATIGRAFICA : chr "" "" "" "" ...
## $ GEOLOGIA_GRUPO_FINAL : chr "Campos" "Lagoa Feia" "Campos" "Campos" ...
## $ GEOLOGIA_FORMACAO_FINAL : chr "Carapebus" "Macabu" "Ubatuba" "Ubatuba" ...
## $ GEOLOGIA_MEMBRO_FINAL : chr "" "" "" "" ...
## $ CDPE : chr "Existe" "Existe" "Existe" "" ...
## $ AGP : chr "" "" "" "" ...
## $ PC : chr "" "Existe" "" "" ...
## $ PAG : chr "" "" "" "" ...
## $ PERFIS_CONVENCIONAIS : chr "" "Existe" "" "" ...
## $ DURANTE_PERFURACAO : chr "Existe" "Existe" "Existe" "Existe" ...
## $ PERFIS_DIGITAIS : chr "" "" "" "" ...
## $ PERFIS_PROCESSADOS : chr "" "" "" "" ...
## $ PERFIS_ESPECIAIS : chr "" "" "" "" ...
## $ AMOSTRA_LATERAL : chr "" "Existe" "" "" ...
## $ SISMICA : chr "" "Existe" "" "" ...
## $ TABELA_TEMPO_PROFUNDIDADE : chr "" "" "" "" ...
## $ DADOS_DIRECIONAIS : chr "Existe" "Existe" "Existe" "Existe" ...
## $ TESTE_A_CABO : chr "Existe" "Existe" "" "" ...
## $ TESTE_DE_FORMACAO : chr "" "" "" "" ...
## $ CANHONEIO : chr "" "" "" "" ...
## $ TESTEMUNHO : chr "" "" "" "" ...
## $ GEOQUIMICA : chr "" "" "" "" ...
## $ SIG_SONDA : chr "SS-49" "DS4" "NB2" "NB2" ...
## $ NOM_SONDA : chr "SEDCO 707" "Deep Ocean Clarion" "Bully 2" "Bully 2" ...
## $ DHA_ATUALIZACAO : chr "28/1/2018 5:00" "28/1/2018 5:00" "28/1/2018 5:00" "28/1/2018 5:00" ...
Se construye la tabla inicial con el conteo de cada categoría.
Direccion <- Datos$DIRECAO
TDFDireccion <- as.data.frame(table(Direccion))
TDFDireccion
## Direccion Freq
## 1 Direcional 5560
## 2 Horizontal 1232
## 3 Vertical 22783
Se obtienen las frecuencas ni y porcentajes hi por categoria.
TDFDireccion$Freq <- as.numeric(as.character(TDFDireccion$Freq))
library(dplyr)
TDFDireccion1 <- Datos$TDFDireccion
TDFDireccion1 <- TDFDireccion %>%
group_by(Direccion) %>%
summarise(
ni = sum(Freq),
hi = round(sum(Freq) / sum(TDFDireccion$Freq)*100, 5))
TDFDireccion1 <- data.frame(TDFDireccion1)
Se añaden los totales generales de frecuencia absoluta y relativa.
TDFDireccion1$fi <- TDFDireccion1$ni / sum(TDFDireccion1$ni)
TDFDireccion1 <- TDFDireccion1 [, c("Direccion", "ni", "hi", "fi")]
total_ni <- sum(TDFDireccion1$ni)
total_hi <- sum(TDFDireccion1$hi)
total_fi <- sum(TDFDireccion1$fi)
TDFDireccion1.1 <- rbind(TDFDireccion1, data.frame( Direccion = "Total",
ni = total_ni,
hi = total_hi,
fi = total_fi))
print(TDFDireccion1.1 )
## Direccion ni hi fi
## 1 Direcional 5560 18.79966 0.1879966
## 2 Horizontal 1232 4.16568 0.0416568
## 3 Vertical 22783 77.03466 0.7703466
## 4 Total 29575 100.00000 1.0000000
Se formatea la tabla final para su presentación en formato gt.
library(gt)
gt(TDFDireccion1.1 ) %>%
tab_header(
title = md("**Tabla N°1: DISTRIBUCIÓN DE FRECUENCIAS DE POZOS PETROLEROS DE BRASIL**"),
subtitle = "Dirección de los pozos petroleros") %>%
tab_spanner(
label = md("**Frecuencia Relativa**"),
columns = c(hi, fi)
) %>%
cols_label(
ni = md("**ni**"),
hi = md("Porcentual (%)"),
fi = md("Fracción")
) %>%
fmt_number(columns = hi, decimals = 2) %>%
fmt_number(columns = fi, decimals = 4) %>%
cols_align(align = "center", columns = everything()) %>%
tab_style(
style = list(cell_fill(color = "#2E4053"),
cell_text(color = "white", weight = "bold")),
locations = cells_title()
) %>%
tab_style(
style = list(cell_fill(color = "#F2F3F4"),
cell_text(weight = "bold", color = "#2E4053")),
locations = cells_column_labels()
) %>%
tab_style(
style = list(cell_fill(color = "#2E4053"),
cell_text(color = "white", weight = "bold")),
locations = cells_column_spanners()
) %>%
tab_style(
style = list(cell_fill(color = "#D5D8DC"),
cell_text(weight = "bold", color = "#2E4053")),
locations = cells_body(rows = nrow(TDFDireccion1.1 ))
) %>%
tab_options(
table.border.top.color = "#2E4053",
table.border.bottom.color = "#2E4053",
column_labels.border.bottom.color = "#2E4053",
data_row.padding = px(6),
table.font.size = px(13)
)
| Tabla N°1: DISTRIBUCIÓN DE FRECUENCIAS DE POZOS PETROLEROS DE BRASIL | |||
| Dirección de los pozos petroleros | |||
| Direccion | ni |
Frecuencia Relativa
|
|
|---|---|---|---|
| Porcentual (%) | Fracción | ||
| Direcional | 5560 | 18.80 | 0.1880 |
| Horizontal | 1232 | 4.17 | 0.0417 |
| Vertical | 22783 | 77.03 | 0.7703 |
| Total | 29575 | 100.00 | 1.0000 |
Se grafica la cantidad observada por categoría sin considerar el total.
TDFDireccion2 <- TDFDireccion1.1[TDFDireccion1.1$Direccion!= "Total", ]
barplot(TDFDireccion2$ni,
main = "Grafica N.1: Distribucion en cantidad segun la direccion de los pozos",
xlab = "Direccion", ylab = "Cantidad",
col = "#263238", names.arg = TDFDireccion2$Direccion,
las = 1, cex.names = 1, cex.axis = 0.8, cex.main = 1)
##” Histograma de frecuencia absoluta global
Se representa la cantidad por categoría con un rango ampliado del eje vertical.
barplot(TDFDireccion2$ni,
main = "Grfica N.2: Distribucion en cantidad segun la direccion de los pozos",
xlab = "Direccion", ylab = "Cantidad",
col = "#263238", names.arg = TDFDireccion2$Direccion,
las = 1, cex.names = 1, cex.axis = 0.8, cex.main = 1,
ylim = c(0,30000))
Se visualizan los porcentajes correspondientes a cada categoría.
TDFDireccion2 <- TDFDireccion1.1[TDFDireccion1.1$Direccion!= "Total", ]
barplot(TDFDireccion2$hi,
main = "Grafica N.3: Distribucion en cantidad segun la direccion de los pozos",
xlab = "Direccion", ylab = "Porcentaje",
col = "#263238", names.arg = TDFDireccion2$Direccion,
las = 1, cex.names = 1, cex.axis = 0.8, cex.main = 1)
Se muestran los porcentajes con una escala vertical extendida.
barplot(TDFDireccion2$ni,
main = "Grfica N.4: Distribucion en cantidad segun la direccion de los pozos",
xlab = "Direccion", ylab = "Porcentaje",
col = "#263238", names.arg = TDFDireccion2$Direccion,
las = 1, cex.names = 1, cex.axis = 0.8, cex.main = 1,
ylim = c(0,30000))
Se representa la distribución porcentual de la variable mediante un gráfico circular.
pie(TDFDireccion2$hi,
main = "Grafica N.5: Distribucion porcentual segun la direccion de los pozos",
radius = 0.9,
labels = paste0(round(TDFDireccion2$hi,2)),
col = c("#2E4053", "#F2F3F4", "#D9E0E6"),
cex = 1, cex.main = 1,
init.angle = 90)
legend(x = -1.95, y =1,
legend = TDFDireccion2$Direccion,
fill = c("#2E4053", "#F2F3F4", "#D9E0E6"),
cex = 1,
title = "Dirección")
Se resume la información descriptiva esencial de la variable.
Conclusiones <- data.frame(
Variable = "Direccion",
`Rango [Min; Max]` = "N/A",
`Media (X̄)` = "N/A",
`Mediana (Me)` = "N/A",
`Moda (Mo)` = "Vertical",
`Varianza (S²)` = "N/A",
`Desv. Est. (S)` = "N/A",
`C.V. (%)` = "N/A",
`Asimetría (As)` = "N/A",
`Curtosis (K)` = "N/A",
`Valores Atípicos` = "N/A",
check.names = FALSE
)
library(gt)
gt(Conclusiones) %>%
tab_header(
title = md("**CONCLUSIONES Y ESTADÍSTICOS**"),
subtitle = "Resumen de Indicadores de la Direccion de los Pozos Petroleros en Brasil") %>%
tab_source_note(source_note = "Autor: Caleb Yanez ") %>%
cols_align(align = "center", columns = everything()) %>%
tab_style(
style = list(cell_fill(color = "#2E4053"), cell_text(color = "white", weight = "bold")),
locations = cells_title()
) %>%
tab_style(
style = list(cell_fill(color = "#F2F3F4"), cell_text(weight = "bold", color = "#2E4053")),
locations = cells_column_labels()
) %>%
tab_options(
table.border.top.color = "#2E4053",
table.border.bottom.color = "#2E4053",
column_labels.border.bottom.color = "#2E4053",
data_row.padding = px(6))
| CONCLUSIONES Y ESTADÍSTICOS | ||||||||||
| Resumen de Indicadores de la Direccion de los Pozos Petroleros en Brasil | ||||||||||
| Variable | Rango [Min; Max] | Media (X̄) | Mediana (Me) | Moda (Mo) | Varianza (S²) | Desv. Est. (S) | C.V. (%) | Asimetría (As) | Curtosis (K) | Valores Atípicos |
|---|---|---|---|---|---|---|---|---|---|---|
| Direccion | N/A | N/A | N/A | Vertical | N/A | N/A | N/A | N/A | N/A | N/A |
| Autor: Caleb Yanez | ||||||||||
La dirección Vertical es la moda de la variable, al registrar la mayor frecuencia absoluta y relativa. Esto evidencia que la mayoría de los pozos petroleros presentan una configuración vertical, mientras que las direcciones direccional y horizontal tienen una participación menor en el conjunto de datos.