Reading time series in R

Hey :wink: I've given the following time series in R:

07:52:00
07:53:00
07:54:00
07:55:00
08:30:00
08:34:00
08:35:00
08:36:00
08:41:00
08:45:00
08:49:00
08:50:00
08:50:38
08:50:58
08:51:00
08:51:12
08:51:51
08:51:55
08:52:00
08:53:00
08:54:00
08:54:36
08:56:00
08:56:58
08:57:23
08:57:39
09:00:00
09:00:08
09:03:44
09:03:52
09:04:00
09:05:32
09:05:39
09:05:44
09:06:53
09:09:46
09:12:00
09:15:15
09:18:58
09:20:36
09:20:48
09:24:47
09:30:20
09:32:00
09:33:58
09:35:00
09:35:40
09:35:50
09:39:54
09:45:26
09:49:00
09:49:02
09:50:43
09:50:54
09:54:55
10:00:30
10:04:08
10:05:47
10:05:56
10:10:08
10:15:19
10:15:24
10:19:10
10:20:49
10:25:08
10:26:00
10:30:24
10:30:26
10:34:10
10:35:50
10:36:00
10:39:06
10:40:13
10:44:00
10:45:25
10:47:11
10:49:14
10:50:52
10:53:00
10:54:06
10:54:07
10:55:00
10:55:17
11:02:11
11:02:34
11:09:00
11:09:08
11:09:11
11:10:19
11:12:00
11:12:58
11:13:40
11:16:04
11:16:31
11:16:43
11:18:00
11:19:00
11:20:36
11:22:00
11:23:00
11:24:18
11:26:00
11:28:41
11:31:00
11:31:38
11:31:50
11:33:00
11:33:10
11:39:22
11:40:00
11:43:44
11:44:00
11:46:38
11:46:50
11:47:38
11:47:52
11:48:15
11:48:25
11:49:00
11:50:20
11:50:23
11:50:32
11:50:38
11:51:09
11:52:00
11:52:38
11:52:52
11:53:06
11:54:13
11:55:15
11:55:34
11:56:00
11:57:00
11:57:36
11:57:40
11:57:58
11:58:06
11:58:47
11:59:00
11:59:06
11:59:08
12:01:58
12:02:00
12:03:00
12:04:00
12:05:00
12:10:00
12:10:48
12:11:06
12:12:17
12:12:20
12:12:44
12:13:00
12:14:00
12:16:00
12:17:00
12:18:19
12:26:06
12:27:10
12:27:21
12:27:47
12:33:28
12:35:00
12:40:00
12:41:06
12:42:12
12:42:29
12:42:54
12:44:00
12:45:00
12:48:31
12:50:00
12:56:00
12:56:08
12:57:00
12:57:15
12:57:29
12:57:57
12:58:00
13:03:34
13:11:00
13:11:12
13:12:00
13:12:19
13:12:33
13:13:00
13:18:37
13:19:40
13:20:25
13:22:25
13:22:57
13:23:00
13:25:42
13:25:54
13:26:00
13:26:47
13:26:56
13:27:00
13:27:22
13:31:15
13:31:36
13:31:45
13:32:24
13:32:25
13:32:26
13:32:34
13:32:38
13:32:41
13:33:00
13:33:36
13:35:14
13:36:34
13:37:00
13:38:24
13:38:26
13:41:46
13:43:07
13:45:00
13:50:00
13:53:00
14:00:00
14:03:29
14:03:38
14:05:00
14:06:00
14:35:00
14:41:00
14:45:00
14:57:00
15:01:00
15:11:00
15:16:00
15:49:00
15:54:00
15:56:00
16:18:00
16:19:00
16:30:00
16:31:00
16:32:00

The Problem is: R doesn't read it like a time series, but as characters. How can i convert this character list to a time series? I've tried the command "as.POSIXct" and "as.Date", but they didn't work, because both commands have Problems with the current format of the time series. Can anyone help me? And does anyone has a reading suggestions for handling time series in R (where I can learn for example: How can I tell R it should analyse a certain time interval from a reference time point + 10 minutes)?

Thank you!

You can convert the character entries to the class hms with the parse_hms function from the hms package.

library(hms)
DF <- read.csv("c:/users/fjcc/Documents/R/Dummy.csv", header = FALSE, stringsAsFactors = FALSE)
summary(DF)
#>       V1           
#>  Length:240        
#>  Class :character  
#>  Mode  :character
DF$V1 <- parse_hms(DF$V1)
summary(DF)
#>       V1          
#>  Length:240       
#>  Class1:hms       
#>  Class2:difftime  
#>  Mode  :numeric

Created on 2020-01-04 by the reprex package (v0.3.0)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.