I am working with air quality time series data to identify pollution episodes and am interested in the exact timing with which an episode hits a receptor. I have a rough idea of when the episodes occur from hourly data but want to identify the beginning of a peak at the 1 or 5 min averaging time.
The code below appears to select the correct number of entries, but it does not bring in the data from the time series data frame.
I'm trying to avoid analyzing 400+ individual plots, TIA for all help.
library(tidyverse)
library(purrr)
library(dplyr)
library(lubridate)
library(quantmod)
knitr::opts_chunk$set(warning = FALSE, message = FALSE)
episodes <- read.csv("C:\\Users\\Documents\\Thesis Raw Data\\CO_Episode_Timing_After_Separation.csv")
episodes <- episodes |> mutate(across(2:3, ymd_hm))
names(episodes) <- c("event", "start", "stop")
dev150 <- read.csv("C:\\Users\\Documents\\150-sample.csv")
dev150$Date_Time <- ymd_hms(dev150$Date_Time)
AMS1 <- read.csv("C:\\Users\\krist\\Documents\\Thesis Raw Data\\AMS-1 June 20 - Dec 12 2023 5 min.csv")
AMS1$Date_Time <- ymd_hm(AMS1$Date_Time)
AMS1$CO <- AMS1$CO * 1000
for (i in 1:nrow(episodes)) {
start <- episodes$start[i]
end <- episodes$stop[i]
}
int_150 <- dev150[start:end,]
int_ref <- AMS1[start:end,]
Files can be found here: link to files
After creating the intervals, I plan to use quantmod to find peaks.