Hi Community
With this data I'm want to select a filter between 06:00:00 / 18:00:00 and 18:00:00 / 06:00:00.
I'm try this code but don't run well because the second filter don't run well.
library(tidyverse)
url <- "https://docs.google.com/spreadsheets/d/1273NoiIeFYaC5F9lZMkRRNj_6Zq-ztC6/export?format=xlsx"
download.file(url, "TEMP_Nov2022_Feb2023.xlsx")
TEMP <- readxl::read_xlsx("TEMP_Nov2022_Feb2023.xlsx")
TEMP$DATE <- as.Date(TEMP$DATE,format="%d %m %Y" )
TEMP$DATE<- format(TEMP$DATE, "%Y/%m/%d")
TEMP$TIME <- as.POSIXct(TEMP$TIME, format = "%H:%M:%S")
df_filtered <- TEMP %>% filter(TIME >= as.POSIXct("06:00:00", format = "%H:%M:%S") &
TIME < as.POSIXct("18:00:00", format = "%H:%M:%S")) # run well
df_filtered2 <- TEMP %>% filter(TIME >= as.POSIXct("18:10:00", format = "%H:%M:%S") &
TIME < as.POSIXct("06:00:00", format = "%H:%M:%S")) # run wrong
df_summary <- df_filtered %>%
group_by(DATE) %>%
summarize(mean_06_18 = mean(TEMPERATURE))
df_summary
df_summary2 <- df_filtered2 %>%
group_by(DATE) %>%
summarize(mean_18_06 = mean(TEMPERATURE))
df_summary2 # but this not show any values
TEMP_mean <- df_summary |>
left_join(df_summary2, by='DATE')
Tnks