library(readxl)
datos <- read_xlsx("IC2.xlsx", sheet = "1")
##estructura de los datos
str(datos)
## tibble [5,234 × 30] (S3: tbl_df/tbl/data.frame)
## $ Column1 : chr [1:5234] "0" "1" "2" "3" ...
## $ temporada : chr [1:5234] "2016-2017" "2016-2017" "2016-2017" "2016-2017" ...
## $ codreg : chr [1:5234] "3" "3" "3" "3" ...
## $ codprov : chr [1:5234] "33" "33" "33" "33" ...
## $ codcom : chr [1:5234] "3301" "3301" "3301" "3301" ...
## $ ambito : chr [1:5234] "Conaf" "Conaf" "Conaf" "Conaf" ...
## $ numero : chr [1:5234] "2.0" "3.0" "4.0" "5.0" ...
## $ nombre_inc: chr [1:5234] "CALLEJÓN MARTINEZ" "PERALES" "TORINO" "LA VERBENA" ...
## $ utm_este : chr [1:5234] "326931.0" "322031.0" "329713.0" "335543.0" ...
## $ utm_norte : chr [1:5234] "6838495.0" "6840235.0" "6836541.0" "6829112.0" ...
## $ inicio_c : chr [1:5234] "Camino secundario" "Camino secundario" "Orilla curso de agua" "Camino principal" ...
## $ combus_i : chr [1:5234] "Matorral" "Matorral" "Matorral" "Pastizal" ...
## $ causa_gene: chr [1:5234] "2.01" "2.01" "2.01" "1.02" ...
## $ causa_espe: chr [1:5234] "2.1.8." "2.1.8." "2.1.8." "1.2.4." ...
## $ pino_0010 : chr [1:5234] "0.0" "0.0" "0.0" "0.0" ...
## $ pino_11_17: chr [1:5234] "0.0" "0.0" "0.0" "0.0" ...
## $ pino_18 : chr [1:5234] "0.0" "0.0" "0.0" "0.0" ...
## $ eucalipto : chr [1:5234] "0.0" "0.0" "0.22" "0.0" ...
## $ otras_plan: chr [1:5234] "0.0" "0.0" "0.0" "0.0" ...
## $ total_plan: chr [1:5234] "0.0" "0.0" "0.22" "0.0" ...
## $ arbolado : chr [1:5234] "0.0" "0.0" "0.0" "0.0" ...
## $ matorral : chr [1:5234] "0.2" "0.1" "0.05" "0.0" ...
## $ pastizal : chr [1:5234] "0.0" "0.0" "0.0" "0.18" ...
## $ total_veg : chr [1:5234] "0.2" "0.1" "0.05" "0.18" ...
## $ agricola : chr [1:5234] "0.0" "0.0" "0.0" "0.0" ...
## $ desechos : chr [1:5234] "0.0" "0.0" "0.0" "0.0" ...
## $ total_otra: chr [1:5234] "0.0" "0.0" "0.0" "0.0" ...
## $ sup_t_a : chr [1:5234] "0.2" "0.1" "0.27" "0.18" ...
## $ long : chr [1:5234] "326931.0" "322031.0" "329713.0" "335543.0" ...
## $ lat : chr [1:5234] "6838495.0" "6840235.0" "6836541.0" "6829112.0" ...
##Extraer una variable nominal
tipovegetacion <- datos$combus_i
##EDAvariable nominal
TDFtv <- table(tipovegetacion)
TDFtv
## tipovegetacion
## Arbolado natural Basural Cultivo agrÃcola
## 65 27 46
## Desechos Matorral Otras plantaciones
## 277 773 6
## Otros Pastizal Plantacion eucaliptus
## 40 2493 204
## Plantacion pino S/I
## 154 1149
tablatipov <- as.data.frame(TDFtv)
hi <- tablatipov$Freq/sum(tablatipov$Freq)
hi_porc <- hi*100
sum(hi_porc)
## [1] 100
tablatipov <- data.frame(tablatipov,hi_porc)
#tabla1
##distibucion de tipos de vegetacion
tablatipov
## tipovegetacion Freq hi_porc
## 1 Arbolado natural 65 1.2418800
## 2 Basural 27 0.5158579
## 3 Cultivo agrÃcola 46 0.8788689
## 4 Desechos 277 5.2923194
## 5 Matorral 773 14.7688193
## 6 Otras plantaciones 6 0.1146351
## 7 Otros 40 0.7642339
## 8 Pastizal 2493 47.6308750
## 9 Plantacion eucaliptus 204 3.8975927
## 10 Plantacion pino 154 2.9423003
## 11 S/I 1149 21.9526175
#GDF ni
barplot(tablatipov$Freq, main = "Gráfica N°1: Distribución de tipo de material de inicio de los incendios ",
xlab = "",
ylab = "Cantidad",
names.arg = tablatipov$tipovegetacion,
las=2, cex.names = 0.45, cex.axis = 0.5)
mtext("Tipo de vegetacion", side = 1, line = 4, cex = 0.7)

barplot(tablatipov$Freq, main = "Gráfica N°2: Distribución de tipo de material de inicio de los incendios ",
xlab = "",
ylab = "cantidad",
names.arg = tablatipov$tipovegetacion,
las=2, cex.names = 0.45, cex.axis = 0.5, ylim = c(0, length(tipovegetacion)))
mtext("Tipo de vegetacion", side = 1, line = 4, cex = 0.7)

##GDF hi
barplot(tablatipov$hi_porc, main = "Gráfica N°3: Distribución de porcentaje de tipo de materiales fuentes de incendio", cex.main=0.9,
xlab = "",
ylab = "Porcentaje", col = "red",
names.arg = tablatipov$tipovegetacion,
las=2, ylim = c(0,100), cex.names = 0.45, cex.axis = 0.5)
mtext("Tipo de vegetacion", side = 1, line = 4, cex = 0.7)

barplot(tablatipov$hi_porc, main = "Gráfica N°4: Distribución de porcentaje de tipo de materiales fuentes de incendio", cex.main=0.9,
xlab = "",
ylab = "Porcentaje", col = "red",
names.arg = tablatipov$tipovegetacion,
las=2, cex.names = 0.45, cex.axis = 0.5)

##GDFC
porcentaje <- round(hi_porc)
etiqueta <- paste(porcentaje, "%", sep = " ")
colores <- topo.colors(length(hi_porc))
pie(tablatipov$hi_porc, main = ("Gráfica N°5: Porcentajes de cada material fuente de incendio"),labels = etiqueta, cex = 0.6, radius = 1, clockwise = TRUE, col = colores, init.angle = 0)
legend("topright", c("Arbolado natural","Basural","Cultivo agrícola","Desechos","Matorral","Otras plantaciones","Otros","Pastizal","Plantación eucaliptus","Plantación pino","SI"),
cex = 0.6, fill = colores)

####Indicadores###
tabla_indicadores <- data.frame("Variable" =c("Materiales con los que iniciaron los incendios en Chile"),
"Rango" = "R= {x|x ∈ Material ^ x ∈ HojaDatos }",
"X" = " - ",
"Me" = " - ",
"Mo" = " Pastizal ",
"V" = " - ",
"Sd" = " - ",
"Cv" = " - ",
"As" = " - ",
"K" = " - ",
"Valores Atipicos" = " - ")
library(knitr)
kable(tabla_indicadores, align = 'c', caption = "Conclusiones de la variable
material con el que inició el incendio")
Conclusiones de la variable material con el que inició el
incendio
| Materiales con los que iniciaron los incendios en
Chile |
R= {x|x ∈ Material ^ x ∈ HojaDatos } |
- |
- |
Pastizal |
- |
- |
- |
- |
- |
- |