I have measured concentrations of N2O for different samples (Series) during 10 min intervals. Each sample was measured two times a day for 9 days. The N2O analyzer saved data (conc.) every second!
My data now looks like this:
DATE Series V A TIME Concentration
1: 2017-10-18T00:00:00Z O11 0.004022 0.02011 10:16:00.746 0.3512232
2: 2017-10-18T00:00:00Z O11 0.004022 0.02011 10:16:01.382 0.3498687
3: 2017-10-18T00:00:00Z O11 0.004022 0.02011 10:16:02.124 0.3482681
4: 2017-10-18T00:00:00Z O11 0.004022 0.02011 10:16:03.216 0.3459306
5: 2017-10-18T00:00:00Z O11 0.004022 0.02011 10:16:04.009 0.3459124
6: 2017-10-18T00:00:00Z O11 0.004022 0.02011 10:16:04.326 0.3456660
I would like to analyze gas fluxes using the R HMR package. For this, I need to calculate measurement time-points in increasing order out of the exact time (TIME) data points. The time should look like this (table taken from https://cran.r-project.org/web/packages/HMR/HMR.pdf)
Series;V;A;Time;Concentration
k0a; 140.6250; 0.5625; 0; 13.98
k0a; 140.6250; 0.5625; 10; 14.65
k0a; 140.6250; 0.5625; 20; 15.15
k0a; 140.6250; 0.5625; 30; 15.85
How can I calculate this for each individual 10-minute measurement period for each pot? Basically it should list the increasing nr. of seconds as my machine measured conc. every second.
My idea is to group by "Series" and "DATE" and do a loop. Inspired by R: calculate time difference between specific events Something like:
library(dplyr)
df.HMR %>% group_by(DATE, Series) %>%
mutate(time_diff = ????)
I would be very grateful for your help!