With iris
data run well
I don't know why with my data don't run.
library(tidyverse)
library(lubridate)
library(ggpubr)
ENSAYO_1 <- data.frame(structure(list(dia = c("4", "4", "4", "4", "4", "5", "4", "4",
"4", "4", "4", "6", "6", "6", "6", "6", "6"), mes = c("10", "10",
"10", "10", "10", "10", "10", "10", "10", "10", "10", "10", "10",
"10", "10", "10", "10"), anio = c("2022", "2022", "2022", "2022",
"2022", "2022", "2022", "2022", "2022", "2022", "2022", "2022",
"2022", "2022", "2022", "2022", "2022"), hora = c("0:00:00",
"0:10:00", "0:20:00", "0:30:00", "0:40:00", "0:00:00", "23:50:00",
"23:40:00", "23:30:00", "23:20:00", "23:10:00", "0:00:00", "0:10:00",
"0:20:00", "0:30:00", "0:40:00", "0:50:00"), `MEDIANA SENSORES TEMP` = c(23.65,
23.6, 23.9, 24, 23.95, 20.25, 20.3, 20.3, 20.2, 20.35, 20.35,
22.5, 22.5, 22.55, 22.75, 22.5, 22.6), `MEDIANA SENSORES HUM` = c(84.7375,
85.0625, 85.0875, 84.475, 84.4375, 95.5875, 95.6625, 95.8875,
95.025, 95, 95.05, 88.6625, 88.8125, 88.7875, 88.275, 88.7, 89.15
), `DATE AND TIME_2` = c("4 10 2022 0:00:00", "4 10 2022 0:10:00",
"4 10 2022 0:20:00", "4 10 2022 0:30:00", "4 10 2022 0:40:00",
"5 10 2022 0:00:00", "4 10 2022 23:50:00", "4 10 2022 23:40:00",
"4 10 2022 23:30:00", "4 10 2022 23:20:00", "4 10 2022 23:10:00",
"6 10 2022 0:00:00", "6 10 2022 0:10:00", "6 10 2022 0:20:00",
"6 10 2022 0:30:00", "6 10 2022 0:40:00", "6 10 2022 0:50:00"
), fecha = structure(c(1664841600, 1664842200, 1664842800, 1664843400,
1664844000, 1664928000, 1664927400, 1664926800, 1664926200, 1664925600,
1664925000, 1665014400, 1665015000, 1665015600, 1665016200, 1665016800,
1665017400), tzone = "UTC", class = c("POSIXct", "POSIXt")),
fecha_2 = structure(c(19269, 19269, 19269, 19269, 19269,
19270, 19269, 19269, 19269, 19269, 19269, 19271, 19271, 19271,
19271, 19271, 19271), class = "Date")), row.names = c(NA,
-17L), class = c("tbl_df", "tbl", "data.frame")))
# Plot
ENSAYO_1 |> select(MEDIANA.SENSORES.TEMP,fecha_2, hora) |>
group_by(fecha_2) |>
summarise(mean=mean(MEDIANA.SENSORES.TEMP)) |>
{ggplot(.,aes(x=fecha_2,y=mean)) +
geom_point() +
geom_line(color='blue') +
scale_y_continuous(limits = c(min(.$mean),
max(.$mean)),
expand = c(0,0)) +
scale_x_date(date_breaks = "1 day", date_minor_breaks = "1 day",
date_labels = "%d-%b") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1,size = 10)) +
labs(title = 'Ensayo 1 - Sensores Temperatura',
x='',
y='Media temperatura')}
# Error in { : function '{' not supported in RHS call of a pipe (<input>:4:3)
Im dont read this part, Im change and all run excellent.
Notice that I had to use the %>% pipe rather than |>
ENSAYO_1 |> select(MEDIANA.SENSORES.TEMP,fecha_2, hora) %>%
group_by(fecha_2) %>%
summarise(mean=mean(MEDIANA.SENSORES.TEMP)) %>%
{ggplot(.,aes(x=fecha_2,y=mean)) +
geom_point() +
geom_line(color='blue') +
scale_y_continuous(limits = c(min(.$mean)-0.5,
max(.$mean)+0.5),
expand = c(0,0)) +
scale_x_date(date_breaks = "3 day", date_minor_breaks = "3 day",
date_labels = "%d-%b") +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1,size = 10)) +
labs(title = 'Ensayo 1 - Sensores Temperatura',
x='',
y='Media temperatura')}
Tnks!