With data table
library(data.table)
df[,StartTime := as.POSIXct(StartTime)]
df[,sum(Volume), by = as.Date(df$StartTime)]
as.Date V1
1: 2016-01-22 38.53
2: 2016-01-27 110.48
3: 2016-01-25 46.10
4: 2016-01-20 15.93
and with dplyr
library(dplyr)
df %>%
mutate(StartTime = as.POSIXct(StartTime)) %>%
group_by(as.Date(StartTime)) %>%
summarise(sum(Volume))
Here are the data:
df <- as.data.table(read.table(text = "
Session; Volume; StartTime; EndTime
1; 27,75; 2016-01-22 17:00:33.707; 2016-01-27 06:02:54.900
2; 10,78; 2016-01-22 14:31:22.127; 2016-01-23 15:01:20.997
3; 15,88; 2016-01-27 12:46:18.660; 2016-01-27 15:01:23.250
4; 46,10; 2016-01-25 16:01:34.613; 2016-01-25 21:46:35.477
5; 94,60; 2016-01-27 05:38:06.597; 2016-01-27 06:08:06.027
6; 15,93; 2016-01-20 16:15:59.350; 2016-01-21 06:06:43.933",header = T,sep = ";",dec = ","))
source
share