Lectura de datos

library(DT)
datos <- read.csv("depur_24horas.csv")[, -6]
datatable(datos)

Descripción de datos

Los datos tienen las siguientes características:

Visualizaciones

Series temporales

Temperatura del suelo

library(ggplot2)
library(plotly)
library(dplyr)

datos2 <- datos %>%
  mutate(Tiempo2 = seq(30, 86400, by = 30),
         Dia = if_else(condition = Tiempo2 <= 43200,
                       true = "13-Julio",
                       false = "14-Julio"))

#
titulo="Serie temporal de la temperatura del suelo\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = Tiempo2, y = TempSuelo)) +
  geom_line(color = "dodgerblue") +
  geom_vline(xintercept = 0, lty = 2, lwd = 0.7, color = "navy") +
  geom_vline(xintercept = 43200, lty = 2, lwd = 0.7, color = "navy") +
  geom_vline(xintercept = 86400, lty = 2, lwd = 0.7, color = "navy") +
  geom_text(mapping = aes(x = 5000, y = 33, label = "2018/07/13\n(1:46pm)")) +
  geom_text(mapping = aes(x = 47200, y = 33, label = "(1:46am)")) +
  geom_text(mapping = aes(x = 81600, y = 33, label = "2018/07/14\n(1:46pm)")) +
  labs(x = "Tiempo (segundos)", y = "Temperatura del suelo (°C)",
       title = titulo,
       caption = "Las líneas punteadas indican las 0, 12 y 24 horas") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Temperatura ambiental

#
titulo="Serie temporal de la temperatura ambiental\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = Tiempo2, y = TempAmb)) +
  geom_line(color = "orangered") +
  geom_vline(xintercept = 0, lty = 2, lwd = 0.7, color = "navy") +
  geom_vline(xintercept = 43200, lty = 2, lwd = 0.7, color = "navy") +
  geom_vline(xintercept = 86400, lty = 2, lwd = 0.7, color = "navy") +
  geom_text(mapping = aes(x = 4500, y = 17.7, label = "2018/07/13\n(1:46pm)")) +
  geom_text(mapping = aes(x = 46800, y = 17.7, label = "(1:46am)")) +
  geom_text(mapping = aes(x = 82000, y = 17.7, label = "2018/07/14\n(1:46pm)")) +
  labs(x = "Tiempo (segundos)", y = "Temperatura ambiental (°C)",
       title = titulo,
       caption = "Las líneas punteadas indican las 0, 12 y 24 horas") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Humedad ambiental

#
titulo="Serie temporal de la humedad ambiental\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = Tiempo2, y = HumAmb)) +
  geom_line(color = "forestgreen") +
  geom_vline(xintercept = 0, lty = 2, lwd = 0.7, color = "navy") +
  geom_vline(xintercept = 43200, lty = 2, lwd = 0.7, color = "navy") +
  geom_vline(xintercept = 86400, lty = 2, lwd = 0.7, color = "navy") +
  geom_text(mapping = aes(x = 4500, y = 17.7, label = "2018/07/13\n(1:46pm)")) +
  geom_text(mapping = aes(x = 46800, y = 17.7, label = "(1:46am)")) +
  geom_text(mapping = aes(x = 82000, y = 17.7, label = "2018/07/14\n(1:46pm)")) +
  labs(x = "Tiempo (segundos)", y = "Humedad (%)",
       title = titulo,
       caption = "Las líneas punteadas indican las 0, 12 y 24 horas") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Áreas

Temperatura del suelo

#
titulo="Áreas de la temperatura del suelo\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = Tiempo2, y = TempSuelo)) +
  geom_area(color = "navy", fill = "gray45") +
  geom_vline(xintercept = 0, lty = 2, lwd = 0.7, color = "darkred") +
  geom_vline(xintercept = 43200, lty = 2, lwd = 0.7, color = "darkred") +
  geom_vline(xintercept = 86400, lty = 2, lwd = 0.7, color = "darkred") +
  geom_text(mapping = aes(x = 5000, y = 33, label = "2018/07/13\n(1:46pm)")) +
  geom_text(mapping = aes(x = 47200, y = 33, label = "(1:46am)")) +
  geom_text(mapping = aes(x = 81600, y = 33, label = "2018/07/14\n(1:46pm)")) +
  labs(x = "Tiempo (segundos)", y = "Temperatura del suelo (°C)",
       title = titulo,
       caption = "Las líneas punteadas indican las 0, 12 y 24 horas") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Temperatura ambiental

#
titulo="Área de la temperatura ambiental\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = Tiempo2, y = TempAmb)) +
  geom_area(color = "dodgerblue", fill = "gray45") +
  geom_vline(xintercept = 0, lty = 2, lwd = 0.7, color = "darkred") +
  geom_vline(xintercept = 43200, lty = 2, lwd = 0.7, color = "darkred") +
  geom_vline(xintercept = 86400, lty = 2, lwd = 0.7, color = "darkred") +
  geom_text(mapping = aes(x = 4500, y = 17.7, label = "2018/07/13\n(1:46pm)")) +
  geom_text(mapping = aes(x = 46800, y = 17.7, label = "(1:46am)")) +
  geom_text(mapping = aes(x = 82000, y = 17.7, label = "2018/07/14\n(1:46pm)")) +
  labs(x = "Tiempo (segundos)", y = "Temperatura ambiental (°C)",
       title = titulo,
       caption = "Las líneas punteadas indican las 0, 12 y 24 horas") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Humedad ambiental

#
titulo="Aŕea de la humedad ambiental\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = Tiempo2, y = HumAmb)) +
  geom_area(color = "seagreen2", fill = "gray45") +
  geom_vline(xintercept = 0, lty = 2, lwd = 0.7, color = "red") +
  geom_vline(xintercept = 43200, lty = 2, lwd = 0.7, color = "red") +
  geom_vline(xintercept = 86400, lty = 2, lwd = 0.7, color = "red") +
  geom_text(mapping = aes(x = 4500, y = 17.7, label = "2018/07/13\n(1:46pm)")) +
  geom_text(mapping = aes(x = 46800, y = 17.7, label = "(1:46am)")) +
  geom_text(mapping = aes(x = 82000, y = 17.7, label = "2018/07/14\n(1:46pm)")) +
  labs(x = "Tiempo (segundos)", y = "Humedad (%)",
       title = titulo,
       caption = "Las líneas punteadas indican las 0, 12 y 24 horas") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Histogramas

Temperatura del suelo

titulo <- "Distribución temperatura del suelo\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = TempSuelo)) +
  geom_histogram(color = "black", bins = 50) +
  geom_vline(xintercept = mean(datos2$TempSuelo), lty = 2, color = "darkred") +
  labs(x = "Temperatura (°C)", y = "Frecuencia",
       title = titulo,
       caption = "La línea punteada representa la media") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Temperatura ambiental

titulo <- "Distribución temperatura ambiental\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = TempAmb)) +
  geom_histogram(color = "black", bins = 50) +
  geom_vline(xintercept = mean(datos2$TempAmb), lty = 2, color = "darkred") +
  labs(x = "Temperatura (°C)", y = "Frecuencia",
       title = titulo,
       caption = "La línea punteada representa la media") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Humedad ambiental

titulo <- "Distribución humedad ambiental\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = HumAmb)) +
  geom_histogram(color = "black", bins = 100) +
  geom_vline(xintercept = mean(datos2$HumAmb), lty = 2, color = "darkred") +
    labs(x = "Humedad (%)", y = "Frecuencia",
       title = titulo,
       caption = "La línea punteada representa la media") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Temperatura del suelo día 1 vs día 2

titulo <- "Distribución temperatura del suelo por día de medición\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = TempSuelo, fill = Dia)) +
  geom_histogram(color = "black", bins = 50) +
  geom_vline(xintercept = mean(datos2$TempSuelo), lty = 2, color = "orangered") +
  scale_fill_manual(values = c("navy", "dodgerblue")) +
  labs(x = "Temperatura (°C)", y = "Frecuencia",
       title = titulo,
       caption = "La línea punteada representa la media general",
       fill = "Día de medición") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Temperatura ambiental día 1 vs día 2

titulo <- "Distribución temperatura ambiental por día de medición\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = TempAmb, fill = Dia)) +
  geom_histogram(color = "black", bins = 50, alpha = 0.9) +
  geom_vline(xintercept = mean(datos2$TempAmb), lty = 2, color = "black") +
  scale_fill_manual(values = c("firebrick", "dodgerblue")) +
  labs(x = "Temperatura (°C)", y = "Frecuencia",
       title = titulo,
       caption = "La línea punteada representa la media general",
       fill = "Día de medición") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Humedad ambiental día 1 vs día 2

titulo <- "Distribución humedad ambiental por día de medición\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = HumAmb, fill = Dia)) +
  geom_histogram(color = "black", bins = 50, alpha = 0.9) +
  geom_vline(xintercept = mean(datos2$HumAmb), lty = 2, color = "red") +
  scale_fill_manual(values = c("darkmagenta", "chartreuse4")) +
  labs(x = "Humedad (%)", y = "Frecuencia",
       title = titulo,
       caption = "La línea punteada representa la media general",
       fill = "Día de medición") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Boxplots

Temperatura del suelo día 1 vs día 2

titulo <- "Distribución temperatura del suelo por día de medición\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = Dia, y = TempSuelo, fill = Dia)) +
  geom_boxplot(color = "black", bins = 50) +
  geom_hline(yintercept = mean(datos2$TempSuelo), lty = 2, color = "red") +
  scale_fill_manual(values = c("navy", "dodgerblue")) +
  labs(x = "Día", y = "Temperatura (°C)",
       title = titulo,
       caption = "La línea punteada representa la media general",
       fill = "Día de medición") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Temperatura ambiental día 1 vs día 2

titulo <- "Distribución temperatura ambiental por día de medición\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = Dia, y = TempAmb, fill = Dia)) +
  geom_boxplot(color = "black", bins = 50) +
  geom_hline(yintercept = mean(datos2$TempAmb), lty = 2, color = "black") +
  scale_fill_manual(values = c("firebrick", "dodgerblue")) +
  labs(x = "Día", y = "Temperatura (°C)",
       title = titulo,
       caption = "La línea punteada representa la media general",
       fill = "Día de medición") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Humedad ambiental día 1 vs día 2

titulo <- "Distribución humedad ambiental por día de medición\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = Dia, y = HumAmb, fill = Dia)) +
  geom_boxplot(color = "black", bins = 50) +
  geom_hline(yintercept = mean(datos2$HumAmb), lty = 2, color = "black") +
  scale_fill_manual(values = c("darkmagenta", "chartreuse4")) +
  labs(x = "Día", y = "Humedad (%)",
       title = titulo,
       caption = "La línea punteada representa la media general",
       fill = "Día de medición") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Scatterplot

T. Ambiental vs T. Suelo

titulo <- "Relación de temperatura ambiental vs temperatura del suelo\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = TempAmb, y = TempSuelo)) +
  geom_point(pch = 20) +
  geom_smooth(method = "lm", color = "darkmagenta", shape = 2) +
  geom_smooth(method = "loess", color = "blue") +
  geom_smooth(color = "forestgreen") +
  labs(x = "Temperatura ambiental (°C)", y = "Temperatura del suelo (°C)",
       title = titulo) +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

T. Ambiental vs H. Ambiental

titulo <- "Relación de temperatura ambiental vs humedad ambiental\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = TempAmb, y = HumAmb)) +
  geom_point(pch = 20) +
  geom_smooth(method = "lm", color = "navy", shape = 2) +
  geom_smooth(method = "loess", color = "orangered") +
  geom_smooth(color = "dodgerblue") +
  labs(x = "Temperatura ambiental (°C)", y = "Humedad ambiental (%)",
       title = titulo) +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

H. Ambiental vs T. Suelo

titulo <- "Relación de humedad ambiental vs temperatura del suelo\nMediciones durante 24 horas cada 30 segundos"

g <- ggplot(data = datos2, aes(x = HumAmb, y = TempSuelo)) +
  geom_point(pch = 20) +
  geom_smooth(method = "lm", color = "green4", shape = 2) +
  geom_smooth(method = "loess", color = "red") +
  geom_smooth(color = "darkmagenta") +
  labs(x = "Humedad ambiental (%)", y = "Temperatura del suelo (°C)",
       title = titulo) +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))

ggplotly(g)

Correlaciones

library(corrplot)
correlaciones <- cor(datos2[, 3:5])

Matriz 1

corrplot(correlaciones, method = "pie")

Matriz 2

corrplot(correlaciones, method="color")

Matriz 3

corrplot(correlaciones, method="number")