I have two long time series to compare, however, the sampling of them is completely different. The first one is with hourly, the second one is with irregular sampling. I would like to compare Value1 and Value2, so, I would like to select Value1 records from df1 at 02:00 according to df2 dates. How can I solve it in R?
df1:
Date1 | Value1 |
---|---|
2014-01-01 01:00:00 | 0.16 |
2014-01-01 02:00:00 | 0.13 |
2014-01-01 03:00:00 | 0.6 |
2014-01-02 01:00:00 | 0.5 |
2014-01-02 02:00:00 | 0.22 |
2014-01-02 03:00:00 | 0.17 |
2014-01-19 01:00:00 | 0.2 |
2014-01-19 02:00:00 | 0.11 |
2014-01-19 03:00:00 | 0.15 |
2014-01-21 01:00:00 | 0.13 |
2014-01-21 02:00:00 | 0.33 |
2014-01-21 03:00:00 | 0.1 |
2014-01-23 01:00:00 | 0.09 |
2014-01-23 02:00:00 | 0.02 |
2014-01-23 03:00:00 | 0.16 |
df2:
Date2 | Value2 |
---|---|
2014-01-01 | 13 |
2014-01-19 | 76 |
2014-01-23 | 8 |
desired output: df_fused:
Date1 | Value1 | Value2 |
---|---|---|
2014-01-01 02:00:00 | 0.13 | 13 |
2014-01-19 02:00:00 | 0.11 | 76 |
2014-01-23 02:00:00 | 0.02 | 8 |