0

I need to average values over different time steps. Here is the thing:
I have a table 1 with my time values at the beginning and end of my pumping.

Table 1

Timestamp_Start Timestamp_End
2021-06-02 17:57:25 2021-06-02 18:06:37
2021-06-02 18:33:19 2021-06-02 18:42:31
2021-06-02 19:09:13 2021-06-02 19:18:25
2021-06-02 19:44:42 2021-06-02 19:53:53
2021-06-02 20:20:36 2021-06-02 20:29:48
... ...

and this table with my X concentrations :

Table 2

Start End Concentration X
02/06/2021 17:57 02/06/2021 17:58 25.5
02/06/2021 17:58 02/06/2021 17:59 25.1
02/06/2021 17:59 02/06/2021 18:00 24.7
02/06/2021 18:00 02/06/2021 18:01 23.9
02/06/2021 18:01 02/06/2021 18:02 27.2
02/06/2021 18:02 02/06/2021 18:03 24.3
02/06/2021 18:03 02/06/2021 18:04 24.1
02/06/2021 18:04 02/06/2021 18:05 26.7
02/06/2021 18:05 02/06/2021 18:06 27.3
02/06/2021 18:06 02/06/2021 18:07 25.8
02/06/2021 18:07 02/06/2021 18:08 29.9
02/06/2021 18:08 02/06/2021 18:09 30.2
02/06/2021 18:09 02/06/2021 18:10 31.5
02/06/2021 18:10 02/06/2021 18:11 28.9
02/06/2021 18:11 02/06/2021 18:12 25.6
02/06/2021 18:12 02/06/2021 18:13 56.5
02/06/2021 18:13 02/06/2021 18:14 51.2
02/06/2021 18:14 02/06/2021 18:15 35.2
02/06/2021 18:15 02/06/2021 18:16 34.2
02/06/2021 18:16 02/06/2021 18:17 26.9
02/06/2021 18:17 02/06/2021 18:18 15.2
02/06/2021 18:18 02/06/2021 18:19 11.6
02/06/2021 18:19 02/06/2021 18:20 17.5
02/06/2021 18:20 02/06/2021 18:21 25.5
02/06/2021 18:21 02/06/2021 18:22 24.1
02/06/2021 18:22 02/06/2021 18:23 21.2
02/06/2021 18:23 02/06/2021 18:24 26.5
02/06/2021 18:24 02/06/2021 18:25 32.5
02/06/2021 18:25 02/06/2021 18:26 24.5
02/06/2021 18:26 02/06/2021 18:27 26.8
02/06/2021 18:27 02/06/2021 18:28 29.6
02/06/2021 18:28 02/06/2021 18:29 26.7
02/06/2021 18:29 02/06/2021 18:30 26.5
02/06/2021 18:30 02/06/2021 18:31 26.6
02/06/2021 18:31 02/06/2021 18:32 26.7
02/06/2021 18:32 02/06/2021 18:33 28.5
02/06/2021 18:33 02/06/2021 18:34 24.1
02/06/2021 18:34 02/06/2021 18:35 26.5
02/06/2021 18:35 02/06/2021 18:36 34.2
02/06/2021 18:36 02/06/2021 18:37 33.2
02/06/2021 18:37 02/06/2021 18:38 35.6
02/06/2021 18:38 02/06/2021 18:39 30.1
02/06/2021 18:39 02/06/2021 18:40 35.5
02/06/2021 18:40 02/06/2021 18:41 39.8
02/06/2021 18:41 02/06/2021 18:42 22.1
02/06/2021 18:42 02/06/2021 18:43 22.6
02/06/2021 18:43 02/06/2021 18:44 22.4
02/06/2021 18:44 02/06/2021 18:45 11.5
02/06/2021 18:45 02/06/2021 18:46 17.5
02/06/2021 18:46 02/06/2021 18:47 20.6
02/06/2021 18:47 02/06/2021 18:48 22.5
02/06/2021 18:48 02/06/2021 18:49 24.8
02/06/2021 18:49 02/06/2021 18:50 29.6
02/06/2021 18:50 02/06/2021 18:51 30.5
02/06/2021 18:51 02/06/2021 18:52 36.5

I would like in output a table like this :
Table 1

Timestamp_Start Timestamp_End Mean X
2021-06-02 17:57:25 2021-06-02 18:06:37 value = mean of values in Table 2 between this time range
2021-06-02 18:33:19 2021-06-02 18:42:31 value = mean of values in Table 2 between this time range
2021-06-02 19:09:13 2021-06-02 19:18:25 value = mean of values in Table 2 between this time range
2021-06-02 19:44:42 2021-06-02 19:53:53 value = mean of values in Table 2 between this time range
2021-06-02 20:20:36 2021-06-02 20:29:48 value = mean of values in Table 2 between this time range

I need to delete the seconds in Table 1 to be able to merge them with Table2. I am already stuck on this point.
Thank you for your help.

  • What language? What have you tried already? Also please provide reproducible data – Robin Gertenbach Oct 13 '21 at 10:12
  • R langage sorry. I found how to round values so I have all my time series in the same and the right format. I tried this sentence : 'A=merge(Table1, Table2, by="Timestamp_Start")', but it doesn't work, I can't make the mean of values in this way. What do you mean when you talk about "reproducible data"? Thanks – lunae_majicam Oct 13 '21 at 12:19
  • By "reproducible data", Robin means a [minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). Please consider making one as it allows us to help you in the best way. – lovalery Oct 14 '21 at 14:44

0 Answers0