I have a set of data called viewed_at
(in as.POSIXct
format), which looks like this:
[1] "2018-02-28 00:13:00 CET" "2018-02-28 01:52:00 CET" [3] "2018-02-28 01:52:00 CET" "2018-02-28 03:38:00 CET" [5] "2018-02-28 04:53:00 CET" "2018-02-28 04:45:00 CET" [7] "2018-02-28 04:41:00 CET" "2018-02-28 04:12:00 CET" [9] "2018-02-28 05:53:00 CET" "2018-02-28 05:32:00 CET" [11] "2018-02-28 05:33:00 CET" "2018-02-28 05:31:00 CET"
(The dataset is about 100.000 lines)
I want to match the dates and times that are equal and add the frequency next to it.
To do that I used: ts <- table(viewed_at)
The output looks like this:
2018-02-28 00:13:00 2018-02-28 01:52:00 2018-02-28 03:38:00
2 4 2
2018-02-28 04:53:00 2018-02-28 04:41:00 2018-02-28 04:45:00
2 2 2
It seems that everything is in order, but one thing is not: the frequency is doubled everywhere.
Of course, the solution is to divide every frequency by 2, but I really want to know why this happens.
Any suggestions?
Thanks in advance!
RC