Escritura
setwd("/cloud/project")
Datos <- read.csv("DataSet_.csv", sep = ";", fileEncoding = "latin1")
install.packages("dplyr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.5'
## (as 'lib' is unspecified)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
install.packages("ggplot2")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.5'
## (as 'lib' is unspecified)
library(ggplot2)
Tabla Base
Solar <- Datos$solar_aptittude_class
TDF_solar <- table(Solar)
tabla_solar <- as.data.frame(TDF_solar)
hi <- tabla_solar$Freq/sum(tabla_solar$Freq)
hi_porc <- hi*100
tabla_SOLAR <- data.frame(tabla_solar, hi_porc)
colnames(tabla_SOLAR)[1] <- "Aptitud"
Agrupación
tabla_resumen <- tabla_SOLAR %>%
mutate(grupo = case_when(
grepl("Alta", Aptitud, ignore.case = TRUE) ~ "Alta",
grepl("Media", Aptitud, ignore.case = TRUE) ~ "Media",
grepl("Baja", Aptitud, ignore.case = TRUE) ~ "Baja",
TRUE ~ "Otros"
)) %>%
group_by(grupo) %>%
summarise(
Frecuencia = sum(Freq),
Porcentaje = sum(hi_porc)
) %>%
arrange(desc(Frecuencia))
colnames(tabla_resumen) <- c("Aptitud","ni","hi (%)")
tabla_resumen
## # A tibble: 4 × 3
## Aptitud ni `hi (%)`
## <chr> <int> <dbl>
## 1 Alta 4440 62.2
## 2 Media 2641 37.0
## 3 Baja 60 0.840
## 4 Otros 1 0.0140
Totales
totales <- c(
Aptitud = "TOTAL",
ni = sum(tabla_resumen$ni),
hi = sum(tabla_resumen$`hi (%)`)
)
tabla_Solar_Final <- rbind(tabla_resumen, totales)
tabla_Solar_Final
## # A tibble: 5 × 3
## Aptitud ni `hi (%)`
## <chr> <chr> <chr>
## 1 Alta 4440 62.1674600952114
## 2 Media 2641 36.9784374124895
## 3 Baja 60 0.840100812097452
## 4 Otros 1 0.0140016802016242
## 5 TOTAL 7142 100
GRÁFICOS
Gráfico 1 – Frecuencia local
par(mar = c(8, 4, 4, 2))
barplot(tabla_resumen$ni,main="Gráfica N°1: Distribución de la Aptitud Solar",
ylab = "Cantidad",
col = "skyblue",
names.arg=tabla_resumen$Aptitud,
cex.names = 0.8, las = 2)
mtext("Categoría de Aptitud", side = 1, line = 6)

Gráfico 2 – Frecuencia global
barplot(tabla_resumen$ni,main="Gráfica N°2: Distribución de Aptitud Solar (Global)",
ylab = "Cantidad",
col = "skyblue",
ylim = c(0,8000),
names.arg=tabla_resumen$Aptitud,
cex.names = 0.8, las = 2)
mtext("Categoría de Aptitud", side = 1, line = 6)

Gráfico 3 – Porcentaje local
barplot(tabla_resumen$`hi (%)`,main="Gráfica N°3: Distribución porcentual de Aptitud Solar",
ylab = "Porcentaje %",
col = "skyblue",
names.arg=tabla_resumen$Aptitud,
cex.names = 0.8, las = 2)
mtext("Categoría de Aptitud", side = 1, line = 6)

Gráfico 4 – Porcentaje global
barplot(tabla_resumen$`hi (%)`,main="Gráfica N°4: Distribución porcentual global",
ylab = "Porcentaje %",
col = "skyblue",
ylim = c(0,100),
names.arg=tabla_resumen$Aptitud,
cex.names = 0.8, las = 2)
mtext("Categoría de Aptitud", side = 1, line = 6)

Gráfico 5 – Diagrama Circular
pie(tabla_resumen$`hi (%)`,
main = "Gráfica N°5: Distribución porcentual de Aptitud Solar",
radius = 0.9,
labels = paste0(round(tabla_resumen$`hi (%)`,2),"%"),
col = colores <- c("red", "orange", "yellow"),
cex = 0.6)
legend(x = 1.3, y = 0.9,
legend = tabla_resumen$Aptitud,
fill = colores,
cex = 0.6,
title = "Aptitud")

par(xpd = TRUE)
Tabla de Conlusiones
install.packages("knitr")
## Installing package into '/cloud/lib/x86_64-pc-linux-gnu-library/4.5'
## (as 'lib' is unspecified)
library(knitr)
tabla_indicadores <- data.frame(
"Variable" = "Aptitud Solar",
"Rango" = "Alta - Media - Baja",
"X" = "-",
"Me" = "-",
"Mo" = "Alta",
"V" = "-",
"Sd" = "-",
"Cv" = "-",
"As" = "-",
"K" = "-",
"Valores Atipicos" = "-"
)
kable(tabla_indicadores, align = 'c', caption = "Conclusiones de la variable Aptitud Solar")
Conclusiones de la variable Aptitud Solar
| Aptitud Solar |
Alta - Media - Baja |
- |
- |
Alta |
- |
- |
- |
- |
- |
- |