I have a time and date-based dataset. I need to do second-, minute-, hour-, date-, and weekly-based correlation and regression analysis.
The variables I have are MeasTime, RawCH4, RawH2, ConveCH4, and ConvH2. So I need to do second, minute-, hour-, date-, and weekly-based correlation and regression of RawCH4 and ConveCH4. When run the data bydfr=lm(RawCH4~ConveCH4, df) I got second-based regression and correlation. But I need to see the regression and correlation of these variables by minutes, hours, and dates. So how do I categorize/subset my dataset and get the regression and correlation analysis on a minute-, hour-, date-, and weekly-based basis? I can subset the dataset by time and date and do the correlation and regression analysis for each minute, hour, date, and time, but this method takes a long time. So, how can I get the result time- and date-based?
MeasTime RawCH4 RawH2 ConvCH4 ConvH2
<chr> <dbl> <dbl> <dbl> <dbl>
1 1/12/2022 0:0000 1233 436 1233 436
2 1/12/2022 0:0001 1225 436 1225 436
3 1/12/2022 0:0002 1233 436 1233 436
4 1/12/2022 0:0003 1233 436 1233 436
5 1/12/2022 0:0004 1229 435 1229 435
6 1/12/2022 0:0005 1233 435 1233 435
7 1/12/2022 0:0006 1232 434 1232 434
8 1/12/2022 0:0007 1229 436 1229 436
9 1/12/2022 0:0008 1237 436 1237 436
10 1/12/2022 0:0009 1233 436 1233 436