GGPlot - how to format x-axis for stopwatch like times - r

This seems relatively straightforward and possibly doable with scale_x_datetime or scale_x_discrete.
I have a column with time increments like on a stopwatch:
[1] 0:00:01 0:00:02 0:00:03 0:00:04 0:00:05 0:00:06
1800 Levels: 0:00:01 0:00:02 0:00:03 0:00:04 0:00:05 0:00:06 0:00:07 ... 0:30:00
Using ggplot how can I set the x-axis labels for 30 second intervals?
Reproducible data:
structure(list(`somedata$Time` = structure(1:4, .Label = c("0:00:01",
"0:00:02", "0:00:03", "0:00:04", "0:00:05", "0:00:06", "0:00:07",
"0:00:08", "0:00:09", "0:00:10", "0:00:11", "0:00:12", "0:00:13",
"0:00:14", "0:00:15", "0:00:16", "0:00:17", "0:00:18", "0:00:19",
"0:00:20", "0:00:21", "0:00:22", "0:00:23", "0:00:24", "0:00:25",
"0:00:26", "0:00:27", "0:00:28", "0:00:29", "0:00:30", "0:00:31",
"0:00:32", "0:00:33", "0:00:34", "0:00:35", "0:00:36", "0:00:37",
"0:00:38", "0:00:39", "0:00:40", "0:00:41", "0:00:42", "0:00:43",
"0:00:44", "0:00:45", "0:00:46", "0:00:47", "0:00:48", "0:00:49",
"0:00:50", "0:00:51", "0:00:52", "0:00:53", "0:00:54", "0:00:55",
"0:00:56", "0:00:57", "0:00:58", "0:00:59", "0:01:00", "0:01:01",
"0:01:02", "0:01:03", "0:01:04", "0:01:05", "0:01:06", "0:01:07",
"0:01:08", "0:01:09", "0:01:10", "0:01:11", "0:01:12", "0:01:13",
"0:01:14", "0:01:15", "0:01:16", "0:01:17", "0:01:18", "0:01:19",
"0:01:20", "0:01:21", "0:01:22", "0:01:23", "0:01:24", "0:01:25",
"0:01:26", "0:01:27", "0:01:28", "0:01:29", "0:01:30", "0:01:31",
"0:01:32", "0:01:33", "0:01:34", "0:01:35", "0:01:36", "0:01:37",
"0:01:38", "0:01:39", "0:01:40", "0:01:41", "0:01:42", "0:01:43",
"0:01:44", "0:01:45", "0:01:46", "0:01:47", "0:01:48", "0:01:49",
"0:01:50", "0:01:51", "0:01:52", "0:01:53", "0:01:54", "0:01:55",
"0:01:56", "0:01:57", "0:01:58", "0:01:59", "0:02:00", "0:02:01",
"0:02:02", "0:02:03", "0:02:04", "0:02:05", "0:02:06", "0:02:07",
"0:02:08", "0:02:09", "0:02:10", "0:02:11", "0:02:12", "0:02:13",
"0:02:14", "0:02:15", "0:02:16", "0:02:17", "0:02:18", "0:02:19",
"0:02:20", "0:02:21", "0:02:22", "0:02:23", "0:02:24", "0:02:25",
"0:02:26", "0:02:27", "0:02:28", "0:02:29", "0:02:30", "0:02:31",
"0:02:32", "0:02:33", "0:02:34", "0:02:35", "0:02:36", "0:02:37",
"0:02:38", "0:02:39", "0:02:40", "0:02:41", "0:02:42", "0:02:43",
"0:02:44", "0:02:45", "0:02:46", "0:02:47", "0:02:48", "0:02:49",
"0:02:50", "0:02:51", "0:02:52", "0:02:53", "0:02:54", "0:02:55",
"0:02:56", "0:02:57", "0:02:58", "0:02:59", "0:03:00", "0:03:01",
"0:03:02", "0:03:03", "0:03:04", "0:03:05", "0:03:06", "0:03:07",
"0:03:08", "0:03:09", "0:03:10", "0:03:11", "0:03:12", "0:03:13",
"0:03:14", "0:03:15", "0:03:16", "0:03:17", "0:03:18", "0:03:19",
"0:03:20", "0:03:21", "0:03:22", "0:03:23", "0:03:24", "0:03:25",
"0:03:26", "0:03:27", "0:03:28", "0:03:29", "0:03:30", "0:03:31",
"0:03:32", "0:03:33", "0:03:34", "0:03:35", "0:03:36", "0:03:37",
"0:03:38", "0:03:39", "0:03:40", "0:03:41", "0:03:42", "0:03:43",
"0:03:44", "0:03:45", "0:03:46", "0:03:47", "0:03:48", "0:03:49",
"0:03:50", "0:03:51", "0:03:52", "0:03:53", "0:03:54", "0:03:55",
"0:03:56", "0:03:57", "0:03:58", "0:03:59", "0:04:00", "0:04:01",
"0:04:02", "0:04:03", "0:04:04", "0:04:05", "0:04:06", "0:04:07",
"0:04:08", "0:04:09", "0:04:10", "0:04:11", "0:04:12", "0:04:13",
"0:04:14", "0:04:15", "0:04:16", "0:04:17", "0:04:18", "0:04:19",
"0:04:20", "0:04:21", "0:04:22", "0:04:23", "0:04:24", "0:04:25",
"0:04:26", "0:04:27", "0:04:28", "0:04:29", "0:04:30", "0:04:31",
"0:04:32", "0:04:33", "0:04:34", "0:04:35", "0:04:36", "0:04:37",
"0:04:38", "0:04:39", "0:04:40", "0:04:41", "0:04:42", "0:04:43",
"0:04:44", "0:04:45", "0:04:46", "0:04:47", "0:04:48", "0:04:49",
"0:04:50", "0:04:51", "0:04:52", "0:04:53", "0:04:54", "0:04:55",
"0:04:56", "0:04:57", "0:04:58", "0:04:59", "0:05:00", "0:05:01",
"0:05:02", "0:05:03", "0:05:04", "0:05:05", "0:05:06", "0:05:07",
"0:05:08", "0:05:09", "0:05:10", "0:05:11", "0:05:12", "0:05:13",
"0:05:14", "0:05:15", "0:05:16", "0:05:17", "0:05:18", "0:05:19",
"0:05:20", "0:05:21", "0:05:22", "0:05:23", "0:05:24", "0:05:25",
"0:05:26", "0:05:27", "0:05:28", "0:05:29", "0:05:30", "0:05:31",
"0:05:32", "0:05:33", "0:05:34", "0:05:35", "0:05:36", "0:05:37",
"0:05:38", "0:05:39", "0:05:40", "0:05:41", "0:05:42", "0:05:43",
"0:05:44", "0:05:45", "0:05:46", "0:05:47", "0:05:48", "0:05:49",
"0:05:50", "0:05:51", "0:05:52", "0:05:53", "0:05:54", "0:05:55",
"0:05:56", "0:05:57", "0:05:58", "0:05:59", "0:06:00", "0:06:01",
"0:06:02", "0:06:03", "0:06:04", "0:06:05", "0:06:06", "0:06:07",
"0:06:08", "0:06:09", "0:06:10", "0:06:11", "0:06:12", "0:06:13",
"0:06:14", "0:06:15", "0:06:16", "0:06:17", "0:06:18", "0:06:19",
"0:06:20", "0:06:21", "0:06:22", "0:06:23", "0:06:24", "0:06:25",
"0:06:26", "0:06:27", "0:06:28", "0:06:29", "0:06:30", "0:06:31",
"0:06:32", "0:06:33", "0:06:34", "0:06:35", "0:06:36", "0:06:37",
"0:06:38", "0:06:39", "0:06:40", "0:06:41", "0:06:42", "0:06:43",
"0:06:44", "0:06:45", "0:06:46", "0:06:47", "0:06:48", "0:06:49",
"0:06:50", "0:06:51", "0:06:52", "0:06:53", "0:06:54", "0:06:55",
"0:06:56", "0:06:57", "0:06:58", "0:06:59", "0:07:00", "0:07:01",
"0:07:02", "0:07:03", "0:07:04", "0:07:05", "0:07:06", "0:07:07",
"0:07:08", "0:07:09", "0:07:10", "0:07:11", "0:07:12", "0:07:13",
"0:07:14", "0:07:15", "0:07:16", "0:07:17", "0:07:18", "0:07:19",
"0:07:20", "0:07:21", "0:07:22", "0:07:23", "0:07:24", "0:07:25",
"0:07:26", "0:07:27", "0:07:28", "0:07:29", "0:07:30", "0:07:31",
"0:07:32", "0:07:33", "0:07:34", "0:07:35", "0:07:36", "0:07:37",
"0:07:38", "0:07:39", "0:07:40", "0:07:41", "0:07:42", "0:07:43",
"0:07:44", "0:07:45", "0:07:46", "0:07:47", "0:07:48", "0:07:49",
"0:07:50", "0:07:51", "0:07:52", "0:07:53", "0:07:54", "0:07:55",
"0:07:56", "0:07:57", "0:07:58", "0:07:59", "0:08:00", "0:08:01",
"0:08:02", "0:08:03", "0:08:04", "0:08:05", "0:08:06", "0:08:07",
"0:08:08", "0:08:09", "0:08:10", "0:08:11", "0:08:12", "0:08:13",
"0:08:14", "0:08:15", "0:08:16", "0:08:17", "0:08:18", "0:08:19",
"0:08:20", "0:08:21", "0:08:22", "0:08:23", "0:08:24", "0:08:25",
"0:08:26", "0:08:27", "0:08:28", "0:08:29", "0:08:30", "0:08:31",
"0:08:32", "0:08:33", "0:08:34", "0:08:35", "0:08:36", "0:08:37",
"0:08:38", "0:08:39", "0:08:40", "0:08:41", "0:08:42", "0:08:43",
"0:08:44", "0:08:45", "0:08:46", "0:08:47", "0:08:48", "0:08:49",
"0:08:50", "0:08:51", "0:08:52", "0:08:53", "0:08:54", "0:08:55",
"0:08:56", "0:08:57", "0:08:58", "0:08:59", "0:09:00", "0:09:01",
"0:09:02", "0:09:03", "0:09:04", "0:09:05", "0:09:06", "0:09:07",
"0:09:08", "0:09:09", "0:09:10", "0:09:11", "0:09:12", "0:09:13",
"0:09:14", "0:09:15", "0:09:16", "0:09:17", "0:09:18", "0:09:19",
"0:09:20", "0:09:21", "0:09:22", "0:09:23", "0:09:24", "0:09:25",
"0:09:26", "0:09:27", "0:09:28", "0:09:29", "0:09:30", "0:09:31",
"0:09:32", "0:09:33", "0:09:34", "0:09:35", "0:09:36", "0:09:37",
"0:09:38", "0:09:39", "0:09:40", "0:09:41", "0:09:42", "0:09:43",
"0:09:44", "0:09:45", "0:09:46", "0:09:47", "0:09:48", "0:09:49",
"0:09:50", "0:09:51", "0:09:52", "0:09:53", "0:09:54", "0:09:55",
"0:09:56", "0:09:57", "0:09:58", "0:09:59", "0:10:00", "0:10:01",
"0:10:02", "0:10:03", "0:10:04", "0:10:05", "0:10:06", "0:10:07",
"0:10:08", "0:10:09", "0:10:10", "0:10:11", "0:10:12", "0:10:13",
"0:10:14", "0:10:15", "0:10:16", "0:10:17", "0:10:18", "0:10:19",
"0:10:20", "0:10:21", "0:10:22", "0:10:23", "0:10:24", "0:10:25",
"0:10:26", "0:10:27", "0:10:28", "0:10:29", "0:10:30", "0:10:31",
"0:10:32", "0:10:33", "0:10:34", "0:10:35", "0:10:36", "0:10:37",
"0:10:38", "0:10:39", "0:10:40", "0:10:41", "0:10:42", "0:10:43",
"0:10:44", "0:10:45", "0:10:46", "0:10:47", "0:10:48", "0:10:49",
"0:10:50", "0:10:51", "0:10:52", "0:10:53", "0:10:54", "0:10:55",
"0:10:56", "0:10:57", "0:10:58", "0:10:59", "0:11:00", "0:11:01",
"0:11:02", "0:11:03", "0:11:04", "0:11:05", "0:11:06", "0:11:07",
"0:11:08", "0:11:09", "0:11:10", "0:11:11", "0:11:12", "0:11:13",
"0:11:14", "0:11:15", "0:11:16", "0:11:17", "0:11:18", "0:11:19",
"0:11:20", "0:11:21", "0:11:22", "0:11:23", "0:11:24", "0:11:25",
"0:11:26", "0:11:27", "0:11:28", "0:11:29", "0:11:30", "0:11:31",
"0:11:32", "0:11:33", "0:11:34", "0:11:35", "0:11:36", "0:11:37",
"0:11:38", "0:11:39", "0:11:40", "0:11:41", "0:11:42", "0:11:43",
"0:11:44", "0:11:45", "0:11:46", "0:11:47", "0:11:48", "0:11:49",
"0:11:50", "0:11:51", "0:11:52", "0:11:53", "0:11:54", "0:11:55",
"0:11:56", "0:11:57", "0:11:58", "0:11:59", "0:12:00", "0:12:01",
"0:12:02", "0:12:03", "0:12:04", "0:12:05", "0:12:06", "0:12:07",
"0:12:08", "0:12:09", "0:12:10", "0:12:11", "0:12:12", "0:12:13",
"0:12:14", "0:12:15", "0:12:16", "0:12:17", "0:12:18", "0:12:19",
"0:12:20", "0:12:21", "0:12:22", "0:12:23", "0:12:24", "0:12:25",
"0:12:26", "0:12:27", "0:12:28", "0:12:29", "0:12:30", "0:12:31",
"0:12:32", "0:12:33", "0:12:34", "0:12:35", "0:12:36", "0:12:37",
"0:12:38", "0:12:39", "0:12:40", "0:12:41", "0:12:42", "0:12:43",
"0:12:44", "0:12:45", "0:12:46", "0:12:47", "0:12:48", "0:12:49",
"0:12:50", "0:12:51", "0:12:52", "0:12:53", "0:12:54", "0:12:55",
"0:12:56", "0:12:57", "0:12:58", "0:12:59", "0:13:00", "0:13:01",
"0:13:02", "0:13:03", "0:13:04", "0:13:05", "0:13:06", "0:13:07",
"0:13:08", "0:13:09", "0:13:10", "0:13:11", "0:13:12", "0:13:13",
"0:13:14", "0:13:15", "0:13:16", "0:13:17", "0:13:18", "0:13:19",
"0:13:20", "0:13:21", "0:13:22", "0:13:23", "0:13:24", "0:13:25",
"0:13:26", "0:13:27", "0:13:28", "0:13:29", "0:13:30", "0:13:31",
"0:13:32", "0:13:33", "0:13:34", "0:13:35", "0:13:36", "0:13:37",
"0:13:38", "0:13:39", "0:13:40", "0:13:41", "0:13:42", "0:13:43",
"0:13:44", "0:13:45", "0:13:46", "0:13:47", "0:13:48", "0:13:49",
"0:13:50", "0:13:51", "0:13:52", "0:13:53", "0:13:54", "0:13:55",
"0:13:56", "0:13:57", "0:13:58", "0:13:59", "0:14:00", "0:14:01",
"0:14:02", "0:14:03", "0:14:04", "0:14:05", "0:14:06", "0:14:07",
"0:14:08", "0:14:09", "0:14:10", "0:14:11", "0:14:12", "0:14:13",
"0:14:14", "0:14:15", "0:14:16", "0:14:17", "0:14:18", "0:14:19",
"0:14:20", "0:14:21", "0:14:22", "0:14:23", "0:14:24", "0:14:25",
"0:14:26", "0:14:27", "0:14:28", "0:14:29", "0:14:30", "0:14:31",
"0:14:32", "0:14:33", "0:14:34", "0:14:35", "0:14:36", "0:14:37",
"0:14:38", "0:14:39", "0:14:40", "0:14:41", "0:14:42", "0:14:43",
"0:14:44", "0:14:45", "0:14:46", "0:14:47", "0:14:48", "0:14:49",
"0:14:50", "0:14:51", "0:14:52", "0:14:53", "0:14:54", "0:14:55",
"0:14:56", "0:14:57", "0:14:58", "0:14:59", "0:15:00", "0:15:01",
"0:15:02", "0:15:03", "0:15:04", "0:15:05", "0:15:06", "0:15:07",
"0:15:08", "0:15:09", "0:15:10", "0:15:11", "0:15:12", "0:15:13",
"0:15:14", "0:15:15", "0:15:16", "0:15:17", "0:15:18", "0:15:19",
"0:15:20", "0:15:21", "0:15:22", "0:15:23", "0:15:24", "0:15:25",
"0:15:26", "0:15:27", "0:15:28", "0:15:29", "0:15:30", "0:15:31",
"0:15:32", "0:15:33", "0:15:34", "0:15:35", "0:15:36", "0:15:37",
"0:15:38", "0:15:39", "0:15:40", "0:15:41", "0:15:42", "0:15:43",
"0:15:44", "0:15:45", "0:15:46", "0:15:47", "0:15:48", "0:15:49",
"0:15:50", "0:15:51", "0:15:52", "0:15:53", "0:15:54", "0:15:55",
"0:15:56", "0:15:57", "0:15:58", "0:15:59", "0:16:00", "0:16:01",
"0:16:02", "0:16:03", "0:16:04", "0:16:05", "0:16:06", "0:16:07",
"0:16:08", "0:16:09", "0:16:10", "0:16:11", "0:16:12", "0:16:13",
"0:16:14", "0:16:15", "0:16:16", "0:16:17", "0:16:18", "0:16:19",
"0:16:20", "0:16:21", "0:16:22", "0:16:23", "0:16:24", "0:16:25",
"0:16:26", "0:16:27", "0:16:28", "0:16:29", "0:16:30", "0:16:31",
"0:16:32", "0:16:33", "0:16:34", "0:16:35", "0:16:36", "0:16:37",
"0:16:38", "0:16:39", "0:16:40", "0:16:41", "0:16:42", "0:16:43",
"0:16:44", "0:16:45", "0:16:46", "0:16:47", "0:16:48", "0:16:49",
"0:16:50", "0:16:51", "0:16:52", "0:16:53", "0:16:54", "0:16:55",
"0:16:56", "0:16:57", "0:16:58", "0:16:59", "0:17:00", "0:17:01",
"0:17:02", "0:17:03", "0:17:04", "0:17:05", "0:17:06", "0:17:07",
"0:17:08", "0:17:09", "0:17:10", "0:17:11", "0:17:12", "0:17:13",
"0:17:14", "0:17:15", "0:17:16", "0:17:17", "0:17:18", "0:17:19",
"0:17:20", "0:17:21", "0:17:22", "0:17:23", "0:17:24", "0:17:25",
"0:17:26", "0:17:27", "0:17:28", "0:17:29", "0:17:30", "0:17:31",
"0:17:32", "0:17:33", "0:17:34", "0:17:35", "0:17:36", "0:17:37",
"0:17:38", "0:17:39", "0:17:40", "0:17:41", "0:17:42", "0:17:43",
"0:17:44", "0:17:45", "0:17:46", "0:17:47", "0:17:48", "0:17:49",
"0:17:50", "0:17:51", "0:17:52", "0:17:53", "0:17:54", "0:17:55",
"0:17:56", "0:17:57", "0:17:58", "0:17:59", "0:18:00", "0:18:01",
"0:18:02", "0:18:03", "0:18:04", "0:18:05", "0:18:06", "0:18:07",
"0:18:08", "0:18:09", "0:18:10", "0:18:11", "0:18:12", "0:18:13",
"0:18:14", "0:18:15", "0:18:16", "0:18:17", "0:18:18", "0:18:19",
"0:18:20", "0:18:21", "0:18:22", "0:18:23", "0:18:24", "0:18:25",
"0:18:26", "0:18:27", "0:18:28", "0:18:29", "0:18:30", "0:18:31",
"0:18:32", "0:18:33", "0:18:34", "0:18:35", "0:18:36", "0:18:37",
"0:18:38", "0:18:39", "0:18:40", "0:18:41", "0:18:42", "0:18:43",
"0:18:44", "0:18:45", "0:18:46", "0:18:47", "0:18:48", "0:18:49",
"0:18:50", "0:18:51", "0:18:52", "0:18:53", "0:18:54", "0:18:55",
"0:18:56", "0:18:57", "0:18:58", "0:18:59", "0:19:00", "0:19:01",
"0:19:02", "0:19:03", "0:19:04", "0:19:05", "0:19:06", "0:19:07",
"0:19:08", "0:19:09", "0:19:10", "0:19:11", "0:19:12", "0:19:13",
"0:19:14", "0:19:15", "0:19:16", "0:19:17", "0:19:18", "0:19:19",
"0:19:20", "0:19:21", "0:19:22", "0:19:23", "0:19:24", "0:19:25",
"0:19:26", "0:19:27", "0:19:28", "0:19:29", "0:19:30", "0:19:31",
"0:19:32", "0:19:33", "0:19:34", "0:19:35", "0:19:36", "0:19:37",
"0:19:38", "0:19:39", "0:19:40", "0:19:41", "0:19:42", "0:19:43",
"0:19:44", "0:19:45", "0:19:46", "0:19:47", "0:19:48", "0:19:49",
"0:19:50", "0:19:51", "0:19:52", "0:19:53", "0:19:54", "0:19:55",
"0:19:56", "0:19:57", "0:19:58", "0:19:59", "0:20:00", "0:20:01",
"0:20:02", "0:20:03", "0:20:04", "0:20:05", "0:20:06", "0:20:07",
"0:20:08", "0:20:09", "0:20:10", "0:20:11", "0:20:12", "0:20:13",
"0:20:14", "0:20:15", "0:20:16", "0:20:17", "0:20:18", "0:20:19",
"0:20:20", "0:20:21", "0:20:22", "0:20:23", "0:20:24", "0:20:25",
"0:20:26", "0:20:27", "0:20:28", "0:20:29", "0:20:30", "0:20:31",
"0:20:32", "0:20:33", "0:20:34", "0:20:35", "0:20:36", "0:20:37",
"0:20:38", "0:20:39", "0:20:40", "0:20:41", "0:20:42", "0:20:43",
"0:20:44", "0:20:45", "0:20:46", "0:20:47", "0:20:48", "0:20:49",
"0:20:50", "0:20:51", "0:20:52", "0:20:53", "0:20:54", "0:20:55",
"0:20:56", "0:20:57", "0:20:58", "0:20:59", "0:21:00", "0:21:01",
"0:21:02", "0:21:03", "0:21:04", "0:21:05", "0:21:06", "0:21:07",
"0:21:08", "0:21:09", "0:21:10", "0:21:11", "0:21:12", "0:21:13",
"0:21:14", "0:21:15", "0:21:16", "0:21:17", "0:21:18", "0:21:19",
"0:21:20", "0:21:21", "0:21:22", "0:21:23", "0:21:24", "0:21:25",
"0:21:26", "0:21:27", "0:21:28", "0:21:29", "0:21:30", "0:21:31",
"0:21:32", "0:21:33", "0:21:34", "0:21:35", "0:21:36", "0:21:37",
"0:21:38", "0:21:39", "0:21:40", "0:21:41", "0:21:42", "0:21:43",
"0:21:44", "0:21:45", "0:21:46", "0:21:47", "0:21:48", "0:21:49",
"0:21:50", "0:21:51", "0:21:52", "0:21:53", "0:21:54", "0:21:55",
"0:21:56", "0:21:57", "0:21:58", "0:21:59", "0:22:00", "0:22:01",
"0:22:02", "0:22:03", "0:22:04", "0:22:05", "0:22:06", "0:22:07",
"0:22:08", "0:22:09", "0:22:10", "0:22:11", "0:22:12", "0:22:13",
"0:22:14", "0:22:15", "0:22:16", "0:22:17", "0:22:18", "0:22:19",
"0:22:20", "0:22:21", "0:22:22", "0:22:23", "0:22:24", "0:22:25",
"0:22:26", "0:22:27", "0:22:28", "0:22:29", "0:22:30", "0:22:31",
"0:22:32", "0:22:33", "0:22:34", "0:22:35", "0:22:36", "0:22:37",
"0:22:38", "0:22:39", "0:22:40", "0:22:41", "0:22:42", "0:22:43",
"0:22:44", "0:22:45", "0:22:46", "0:22:47", "0:22:48", "0:22:49",
"0:22:50", "0:22:51", "0:22:52", "0:22:53", "0:22:54", "0:22:55",
"0:22:56", "0:22:57", "0:22:58", "0:22:59", "0:23:00", "0:23:01",
"0:23:02", "0:23:03", "0:23:04", "0:23:05", "0:23:06", "0:23:07",
"0:23:08", "0:23:09", "0:23:10", "0:23:11", "0:23:12", "0:23:13",
"0:23:14", "0:23:15", "0:23:16", "0:23:17", "0:23:18", "0:23:19",
"0:23:20", "0:23:21", "0:23:22", "0:23:23", "0:23:24", "0:23:25",
"0:23:26", "0:23:27", "0:23:28", "0:23:29", "0:23:30", "0:23:31",
"0:23:32", "0:23:33", "0:23:34", "0:23:35", "0:23:36", "0:23:37",
"0:23:38", "0:23:39", "0:23:40", "0:23:41", "0:23:42", "0:23:43",
"0:23:44", "0:23:45", "0:23:46", "0:23:47", "0:23:48", "0:23:49",
"0:23:50", "0:23:51", "0:23:52", "0:23:53", "0:23:54", "0:23:55",
"0:23:56", "0:23:57", "0:23:58", "0:23:59", "0:24:00", "0:24:01",
"0:24:02", "0:24:03", "0:24:04", "0:24:05", "0:24:06", "0:24:07",
"0:24:08", "0:24:09", "0:24:10", "0:24:11", "0:24:12", "0:24:13",
"0:24:14", "0:24:15", "0:24:16", "0:24:17", "0:24:18", "0:24:19",
"0:24:20", "0:24:21", "0:24:22", "0:24:23", "0:24:24", "0:24:25",
"0:24:26", "0:24:27", "0:24:28", "0:24:29", "0:24:30", "0:24:31",
"0:24:32", "0:24:33", "0:24:34", "0:24:35", "0:24:36", "0:24:37",
"0:24:38", "0:24:39", "0:24:40", "0:24:41", "0:24:42", "0:24:43",
"0:24:44", "0:24:45", "0:24:46", "0:24:47", "0:24:48", "0:24:49",
"0:24:50", "0:24:51", "0:24:52", "0:24:53", "0:24:54", "0:24:55",
"0:24:56", "0:24:57", "0:24:58", "0:24:59", "0:25:00", "0:25:01",
"0:25:02", "0:25:03", "0:25:04", "0:25:05", "0:25:06", "0:25:07",
"0:25:08", "0:25:09", "0:25:10", "0:25:11", "0:25:12", "0:25:13",
"0:25:14", "0:25:15", "0:25:16", "0:25:17", "0:25:18", "0:25:19",
"0:25:20", "0:25:21", "0:25:22", "0:25:23", "0:25:24", "0:25:25",
"0:25:26", "0:25:27", "0:25:28", "0:25:29", "0:25:30", "0:25:31",
"0:25:32", "0:25:33", "0:25:34", "0:25:35", "0:25:36", "0:25:37",
"0:25:38", "0:25:39", "0:25:40", "0:25:41", "0:25:42", "0:25:43",
"0:25:44", "0:25:45", "0:25:46", "0:25:47", "0:25:48", "0:25:49",
"0:25:50", "0:25:51", "0:25:52", "0:25:53", "0:25:54", "0:25:55",
"0:25:56", "0:25:57", "0:25:58", "0:25:59", "0:26:00", "0:26:01",
"0:26:02", "0:26:03", "0:26:04", "0:26:05", "0:26:06", "0:26:07",
"0:26:08", "0:26:09", "0:26:10", "0:26:11", "0:26:12", "0:26:13",
"0:26:14", "0:26:15", "0:26:16", "0:26:17", "0:26:18", "0:26:19",
"0:26:20", "0:26:21", "0:26:22", "0:26:23", "0:26:24", "0:26:25",
"0:26:26", "0:26:27", "0:26:28", "0:26:29", "0:26:30", "0:26:31",
"0:26:32", "0:26:33", "0:26:34", "0:26:35", "0:26:36", "0:26:37",
"0:26:38", "0:26:39", "0:26:40", "0:26:41", "0:26:42", "0:26:43",
"0:26:44", "0:26:45", "0:26:46", "0:26:47", "0:26:48", "0:26:49",
"0:26:50", "0:26:51", "0:26:52", "0:26:53", "0:26:54", "0:26:55",
"0:26:56", "0:26:57", "0:26:58", "0:26:59", "0:27:00", "0:27:01",
"0:27:02", "0:27:03", "0:27:04", "0:27:05", "0:27:06", "0:27:07",
"0:27:08", "0:27:09", "0:27:10", "0:27:11", "0:27:12", "0:27:13",
"0:27:14", "0:27:15", "0:27:16", "0:27:17", "0:27:18", "0:27:19",
"0:27:20", "0:27:21", "0:27:22", "0:27:23", "0:27:24", "0:27:25",
"0:27:26", "0:27:27", "0:27:28", "0:27:29", "0:27:30", "0:27:31",
"0:27:32", "0:27:33", "0:27:34", "0:27:35", "0:27:36", "0:27:37",
"0:27:38", "0:27:39", "0:27:40", "0:27:41", "0:27:42", "0:27:43",
"0:27:44", "0:27:45", "0:27:46", "0:27:47", "0:27:48", "0:27:49",
"0:27:50", "0:27:51", "0:27:52", "0:27:53", "0:27:54", "0:27:55",
"0:27:56", "0:27:57", "0:27:58", "0:27:59", "0:28:00", "0:28:01",
"0:28:02", "0:28:03", "0:28:04", "0:28:05", "0:28:06", "0:28:07",
"0:28:08", "0:28:09", "0:28:10", "0:28:11", "0:28:12", "0:28:13",
"0:28:14", "0:28:15", "0:28:16", "0:28:17", "0:28:18", "0:28:19",
"0:28:20", "0:28:21", "0:28:22", "0:28:23", "0:28:24", "0:28:25",
"0:28:26", "0:28:27", "0:28:28", "0:28:29", "0:28:30", "0:28:31",
"0:28:32", "0:28:33", "0:28:34", "0:28:35", "0:28:36", "0:28:37",
"0:28:38", "0:28:39", "0:28:40", "0:28:41", "0:28:42", "0:28:43",
"0:28:44", "0:28:45", "0:28:46", "0:28:47", "0:28:48", "0:28:49",
"0:28:50", "0:28:51", "0:28:52", "0:28:53", "0:28:54", "0:28:55",
"0:28:56", "0:28:57", "0:28:58", "0:28:59", "0:29:00", "0:29:01",
"0:29:02", "0:29:03", "0:29:04", "0:29:05", "0:29:06", "0:29:07",
"0:29:08", "0:29:09", "0:29:10", "0:29:11", "0:29:12", "0:29:13",
"0:29:14", "0:29:15", "0:29:16", "0:29:17", "0:29:18", "0:29:19",
"0:29:20", "0:29:21", "0:29:22", "0:29:23", "0:29:24", "0:29:25",
"0:29:26", "0:29:27", "0:29:28", "0:29:29", "0:29:30", "0:29:31",
"0:29:32", "0:29:33", "0:29:34", "0:29:35", "0:29:36", "0:29:37",
"0:29:38", "0:29:39", "0:29:40", "0:29:41", "0:29:42", "0:29:43",
"0:29:44", "0:29:45", "0:29:46", "0:29:47", "0:29:48", "0:29:49",
"0:29:50", "0:29:51", "0:29:52", "0:29:53", "0:29:54", "0:29:55",
"0:29:56", "0:29:57", "0:29:58", "0:29:59", "0:30:00"), class = "factor"),
student = c("bob", "bob", "bob", "bob"), somemeasure = c(0L,
0L, 1L, 1L)), .Names = c("somedata$Time", "student", "somemeasure"
), row.names = c(NA, 4L), class = "data.frame")

Assuming that your data frame is named df. First, create new column which is POSIXct by pasting together some arbitrary date and original Time column and then converting with as.POSIXct().
Then use function scale_x_datetime() to set breaks and format for labels you want to see.
df$Time2<-as.POSIXct(paste("1960-01-01 ",df$Time))
library(scales)
ggplot(df,aes(Time2,somemeasure))+geom_point()+
scale_x_datetime(breaks=date_breaks("30 sec"),labels = date_format("%M:%S"))

Related

Plot VAR fitted values with original data R

Suppose you have a matrix of time series, where each column is a time series.
Now, suppose you take second differences of this matrix, (so the data is stationary), using this code:
var_train_data <- diff(var_train, differences = 2)
and then you estimate this model:
var_1 <- VAR(y=var_train_data, lag=9, type="const")
Recall that this function VARcomes from vars package.
How can you plot the original data and the fitted(var_1) data? Is there a function to return the fitted data from the VAR to "level"?
I want to do this but with a VAR.
Thanks in advance!!
Here is the data:
> dput(var_train)
structure(c(8.59225428063812, 8.61632381521795, 8.48941975098913,
8.42616336163893, 8.4656261753598, 8.49981580266834, 8.50658473928686,
8.54846279771184, 8.58669260125764, 8.56316032696837, 8.52323490346238,
8.48186742854092, 8.48127581622944, 8.49729119076164, 8.49055049683316,
8.58344453055748, 8.66539149708416, 7.9357662604667, 6.05291235942189,
6.03890804924141, 5.98225560802266, 5.97240914057282, 5.94306180787981,
6.20137810965131, 6.12654161955374, 5.94624694111468, 5.85594359899009,
5.80529348520438, 5.8381279297813, 5.94886540621632, 5.89095336551159,
5.78449385503938, 5.80588769759335, 5.70948049577085, 5.67528501375454,
5.52325929980363, 5.31085745753021, 5.33500450854624, 5.3938341365814,
5.45958551414416, 5.62663959880732, 5.67152161243798, 5.87292229474808,
6.13320939934395, 6.0539450308861, 5.91620206260743, 5.98431404307914,
5.97698522584315, 6.09421451539306, 6.16657264938364, 6.27079937807193,
6.32011405804798, 6.31492735684061, 6.33107810311843, 6.44029387009958,
6.5049295418109, 6.68300329197134, 7.30512711870751, 7.48990882366175,
7.51140038002074, 7.36108949229449, 7.40527167395002, 7.52991897172882,
7.48794703789686, 7.28420343801981, 7.03762657251759, 6.94570770568258,
6.8027650651245, 6.70994292841968, 6.5635196517431, 6.58704241900519,
6.57918807870411, 6.56763428848419, 6.67249919251384, 6.55714884087979,
6.44556863637826, 6.64144323226655, 6.69044694236696, 6.64031146877134,
6.57024614132845, 6.55644009549116, 6.41999492814714, 6.30406385390409,
6.25618617067998, 6.20859002609663, 6.29478035236011, 6.33882450179958,
6.27861522839648, 6.36442286111981, 6.40470239932559, 6.38864543562845,
6.57792182635296, 6.77748387294482, 6.80771392480191, 6.78808230061387,
6.83179944673993, 6.74635337244069, 6.71228769051817, 6.71323231410622,
6.87445699358062, 6.99334898488415, 7.02875008260248, 6.99559171234453,
6.94609768011091, 6.82185333419185, 6.78972221207055, 7.08994524817146,
6.94355669144552, 6.96382050291509, 7.01613754035382, 7.0956860745406,
7.10902496856521, 7.0683268590798, 7.09328003338984, 7.03698767140573,
6.97311732456672, 6.96941465936886, 6.83249279448159, 6.71302370211151,
6.68918458951307, 6.83687286833789, 6.87816384462923, 6.779867793454,
6.6690749885188, 6.68210859744981, 6.63725803128446, 6.47906806746391,
6.63432043737224, 6.57746390143601, 6.63242090143254, 6.51253166492618,
6.61381121689155, 6.59605370068614, 6.52834257739573, 6.38542432810392,
6.40417606373692, 6.39057618124397, 6.38557758480921, 6.40206794670863,
6.38004182339231, 6.33048455580799, 6.31905391015162, 6.18631691346691,
6.16989597138095, 6.18599200958145, 6.15475193126883, 6.10944958256305,
6.07359299021025, 6.30235729839158, 6.21488078851159, 6.19123711209895,
6.13415226194445, 6.10489951928334, 6.10835829857948, 6.17117854049486,
6.20272828827286, 6.14697144970638, 6.11798126273311, 6.09592248164895,
6.04625173074978, 5.99916211737789, 6.01626801829834, 6.07798622087923,
6.06003704039333, 5.96216446139643, 5.8926960131323, 5.91466063648335,
5.87549237085556, 5.89885310338971, 5.9930422492496, 6.02137002988689,
6.01266675475859, 6.15176510875538, 6.27125844671076, 6.34813949104671,
6.50500387674558, 6.50357881390098, 6.4894121494231, 6.48577961874698,
6.65109576407555, 6.55243995455944, 6.52108609966874, 6.61791214295492,
6.73192688164199, 6.82964630649759, 6.7830420348085, 6.67163010253559,
7.35778808496937, 7.68222895818785, 7.65345178297661, 7.75628546245401,
7.62338589734873, 18.0052565534027, 18.0283161481762, 18.0354203734597,
18.071119409619, 18.1057986145642, 18.1434464627582, 18.1679613320011,
18.1724822603554, 18.1626507380013, 18.1735086813587, 18.2048932826437,
18.2692972785199, 18.2533671856288, 18.2415818049433, 18.2496122176447,
18.2718727763864, 18.3010161442641, 18.3291390076371, 18.3572538287519,
18.3507204046193, 18.3600370069532, 18.3939643481435, 18.4165259145903,
18.4908471052973, 18.4867143437776, 18.4804562806922, 18.469238614477,
18.4879629103507, 18.5207111296724, 18.5392075918007, 18.549601058126,
18.5389132074898, 18.5541926126363, 18.5648519425587, 18.6134248798087,
18.6623309458927, 18.6585086859232, 18.6627389755133, 18.6664151651325,
18.7001141293336, 18.7124583930686, 18.7555889295117, 18.7668588119494,
18.7436675451662, 18.7459556596228, 18.7514145615817, 18.7664618044321,
18.8918838160788, 18.8524507901715, 18.8267408416858, 18.8351746759483,
18.8659203733722, 18.8520280137673, 18.8947341990718, 18.8888147953761,
18.8994685106982, 18.9232996525635, 18.8866047503417, 18.9024896904205,
19.0233652386019, 18.987660272875, 18.9544232700339, 18.9334369249929,
18.9449183299094, 18.9631673064947, 18.9933965789268, 18.9872237290741,
18.9873356136058, 19.0123636641398, 19.0206652835947, 19.0270219591515,
19.1598215152463, 19.1409817254047, 19.1376727583276, 19.1107669946426,
19.1241264422661, 19.1370331827589, 19.1912655465102, 19.2115823692113,
19.2158835209359, 19.2414814594526, 19.2701126456528, 19.2843375695361,
19.457274554838, 19.3897327048706, 19.3892248817594, 19.4122218249334,
19.4394604950819, 19.4541631046363, 19.4997359433774, 19.5176831040473,
19.5230181490842, 19.5320146650821, 19.5251016863462, 19.5528663129766,
19.7183358456188, 19.6474484090812, 19.6534432674726, 19.6576920553381,
19.6789279209334, 19.7218625314866, 19.7970056245357, 19.8212720524189,
19.8242227530495, 19.8192388840771, 19.8436023860703, 19.881222941016,
20.0436302759402, 19.9570453168158, 19.9591040082, 19.9740784817898,
19.9751993031549, 19.986022300742, 20.0531114406967, 20.0696985627145,
20.0800828758451, 20.1153963422351, 20.1076549894179, 20.1267044622338,
20.2723835551353, 20.2393724865888, 20.1653637627644, 20.175313365826,
20.1653179028692, 20.2067113730004, 20.2925659543297, 20.2949687148603,
20.3127893925416, 20.3352981379241, 20.3625848609943, 20.4154309157981,
20.5264488163096, 20.4391570088463, 20.4361213999428, 20.4679188013375,
20.4735221776474, 20.5104401429986, 20.5802596472874, 20.5970515415252,
20.6075988336636, 20.6257156522032, 20.6528395142733, 20.7198461324164,
20.7747860368889, 20.739620648921, 20.7095747158136, 20.6824219109357,
20.6683460262695, 20.6916705410586, 20.759196128171, 20.7576642433693,
20.7734082911213, 20.7797650725761, 20.8116082106002, 20.8694893686511,
21.0404672977562, 20.985356981043, 20.9557258620312, 20.9617164802732,
20.9759120662088, 20.9794392421448, 21.0620148226635, 21.0624457124599,
21.0769973151371, 21.0901703250319, 21.098690344787, 21.1226698925968,
21.2711836808076, 21.2200341433781, 21.207193477524, 21.2331394396842,
21.2179204523064, 21.2683699326247, 21.3524515602354, 21.2680244710733,
21.361479141605, 21.3261431820478, 21.26986226303, 21.2991364766223,
21.4762517489448, 21.3298374568077, 21.3331519252179, 21.3667485789704,
21.3885075875912, 21.3906997195313, 21.4381231831175, 21.458826223458,
21.5063778806171, 21.5151033730744, 21.507010374386, 21.5687143378936,
21.7306835559895, 4.44765724836912, 4.47100191330161, 4.54882158610783,
4.5440708847657, 4.51747797566305, 4.55880902228773, 4.58341393701683,
4.64251003043301, 4.67923099142439, 4.67449572095413, 4.61706049834258,
4.66515462150976, 4.68125825810232, 4.66447683681913, 4.67120538921521,
4.75098823360583, 4.7865929014467, 4.76411723853929, 4.80166768795887,
4.80738451939104, 4.72395597727812, 4.70774920353605, 4.73128098441694,
4.7497092825493, 4.70907556418776, 4.76025128174992, 4.78333093429487,
4.83897472963042, 4.84221516595959, 4.84570544645976, 4.86534283142894,
4.83189781246032, 4.88116983304783, 4.93726397688361, 4.9949887298286,
4.99476493720366, 5.03985402500338, 5.08369093771621, 5.14388523087357,
5.18085114132468, 5.24643999990121, 5.29616550395191, 5.31221160299188,
5.19904892834139, 5.11149173059605, 4.91002237688405, 4.74559139066756,
4.62999621355914, 4.65748259587475, 4.62140362369755, 4.62160891785885,
4.64311994758678, 4.72234866533005, 4.80015528005185, 4.76255281172576,
4.81741428916888, 4.78833902844309, 4.84857045098378, 4.88628200385209,
4.90595450753678, 4.94790389478918, 4.92401525818964, 4.95677349014216,
5.01088694769778, 4.9503589208899, 4.92948635242132, 4.93119567690321,
4.95837860539992, 4.97675522372483, 5.02843176452887, 5.06149708771953,
5.11680002731314, 5.15318428207365, 5.18999785496126, 5.22291283107711,
5.27233625060222, 5.23506513572608, 5.22540885753388, 5.23894254044616,
5.2156683767814, 5.20459712839743, 5.16868853558729, 5.18200968431041,
5.1634206717668, 5.17963852108505, 5.21018392350377, 5.23236124392477,
5.21618459500301, 5.15529912255812, 5.08809220037847, 5.1198724394553,
5.14734561157324, 5.15737088983502, 5.14805750597054, 5.13433360782898,
5.13895940081431, 5.16304129678691, 5.17149369912226, 5.1450893326955,
5.12587216446798, 5.11899200918883, 5.10413318074705, 5.1160008826641,
5.13174199954551, 5.1280052744334, 5.11204768607761, 5.10168238434182,
5.12328408372326, 5.11612649122192, 5.14161587137474, 5.13479881416009,
5.14165443688476, 5.12847989418342, 5.13034008951874, 5.11006252539728,
5.07602981399522, 5.04380082747131, 4.9865270245507, 4.93875062722085,
4.83814457466529, 4.73816812891552, 4.76719339629964, 4.73243951213948,
4.7435649612657, 4.77654431271813, 4.75791190194754, 4.69814760133106,
4.63006025665572, 4.62852090719856, 4.62807952037229, 4.56670114439206,
4.50814804330275, 4.44643563505667, 4.47016149299473, 4.53912223957418,
4.57221861050859, 4.61097392628225, 4.63675759989718, 4.63305952571057,
4.63769373351235, 4.63818304039896, 4.66879922486243, 4.65819557081487,
4.71530442638786, 4.75283411765132, 4.75677199897661, 4.70834590013243,
4.70931748325188, 4.68986307689509, 4.66007542691547, 4.68658557879665,
4.71287923105122, 4.74116955758817, 4.75433533727191, 4.79454505679725,
4.80874809318759, 4.86630450704699, 4.84278723259879, 4.83917234051045,
4.85488742314064, 4.89072885950008, 4.88255695031045, 4.86964539401132,
4.85185198871889, 4.88602282140254, 4.89354723701055, 4.80281371512246,
4.75326969467741, 4.7628424628326, 4.77922033722999, 4.78674176423299,
4.81556668261512, 4.79146335227998, 4.74952108237436, 4.77041301487697,
4.71934595594234, 4.74327045521818, 4.7274675891773, 4.76201943815388,
4.78742822435935, 4.7838694829636, 4.70898722458582, 4.54042300123519,
4.43046567457835, 4.51451988598857, 4.60392217055997, 4.635511244447,
4.69067644375465, 4.68405634850711, 4.70605958678574, 4.74618067900467,
4.83260092214898, 4.58877721775886, 4.5853033584615, 4.58186865729406,
4.55644763424071, 4.57312995884514, 4.59141300784382, 4.61405195391224,
4.62539633475001, 4.62855764989542, 4.63775153880854, 4.6400153979937,
4.63484394226681, 4.66244207350167, 4.66434146018009, 4.67076691372282,
4.68407880009055, 4.68958339529632, 4.68622457601331, 4.69208811620889,
4.6940756895394, 4.69428420237835, 4.70035131806994, 4.71249186301022,
4.7271653599702, 4.7349479901132, 4.74160205558268, 4.74031934574645,
4.75062724305051, 4.74555258590119, 4.7562138340694, 4.77117641542375,
4.77731860313779, 4.78678284676528, 4.79153067887926, 4.79406738928742,
4.81477266396795, 4.80529042610458, 4.82344884188224, 4.84012452381554,
4.82978062729767, 4.84653955140898, 4.85661455200409, 4.84934319669535,
4.85983345926684, 4.86432477646786, 4.87752996938969, 4.88896248079701,
4.89778714881147, 4.90781018324614, 4.89428104718603, 4.88909193570591,
4.91223232224708, 4.90441909943736, 4.89184080947695, 4.90838616906774,
4.9120349738912, 4.91193835958192, 4.88849965474606, 4.86952089013496,
4.82754082787148, 4.82297945991404, 4.83636363788566, 4.81537478739995,
4.80170678155239, 4.79837796712813, 4.80808503798778, 4.82809683942688,
4.84168009931907, 4.85375583235012, 4.86250775605786, 4.86576774877652,
4.85101858001533, 4.88095185322792, 4.889979963576, 4.89811535971474,
4.91927159620284, 4.93489213808326, 4.94589827772837, 4.93753721242439,
4.94070114394025, 4.93820671550976, 4.94272951036566, 4.9566005031372,
4.95762163540098, 4.98371534679409, 4.97127518438922, 4.97300329929901,
4.97577277168663, 4.99013444353118, 4.98890830668264, 4.99059253380479,
4.98920233887426, 5.00013814038861, 4.99339203377456, 4.99332756375832,
4.99585549034717, 4.99514277314306, 4.97378016705823, 4.98107090641032,
4.95128483491647, 4.94360774445335, 4.94820569518161, 4.97397566869503,
4.97837258336568, 4.98575124596766, 4.99233525890304, 4.9912972420199,
5.00502716857625, 4.98574031284931, 4.99974886393147, 5.00248006801806,
5.00029210629614, 5.00032426635492, 5.00234130906807, 4.99807143017482,
5.01211153206913, 5.01282969959663, 5.00369558714223, 4.99803646081775,
4.99122145915995, 4.98203245011163, 4.98898183118227, 4.97676031402907,
4.97661306140277, 4.97790228452433, 4.97467881736556, 4.97074319702324,
4.96777121735822, 4.96666260100269, 4.97008836269719, 4.97439822264025,
4.97499263100689, 4.97356254116369, 4.99650332598755, 4.99359641505544,
5.00958842621975, 5.00937803525786, 5.01453325868578, 5.01528247340244,
5.01105287591122, 5.00468878177894, 5.00658901722306, 5.0002693118926,
4.98932483790769, 4.99855492515587, 4.98814720173172, 4.98315862786098,
4.97816073933055, 4.97250227511499, 4.97217034019837, 4.9727134145512,
4.98093640727607, 4.97743699009155, 4.97708205787666, 4.98170032114438,
4.98999371770747, 4.99342868670462, 4.98710032461129, 4.99711328978229,
4.99575482652789, 5.00170349753027, 5.01247168017715, 5.01239395194275,
5.01245423405598, 5.01879001126698, 5.02033652362449, 5.02739033730593,
5.02651459803757, 5.02453819926525, 5.02388052084628, 5.01926462079431,
4.98975208317983, 4.97258722645873, 4.9635436865624, 4.96424225452655,
4.98770778945255, 4.9635436865624, 4.96633503519968, 4.95371214669663,
4.95441761409803, 4.96214508493582, 4.96772779308498, 4.95159275346247,
4.95934199970871, 4.97397130972466, 4.96772779308498, 4.97880057057624,
4.97535347995162, 4.94946885885877, 4.96494033483413, 4.94662996412034,
4.94378298710842, 7.48320429381319, 7.6561645369399, 7.82110610880829,
7.59320189720296, 7.68683478110016, 7.95667983810111, 7.59617632139741,
7.62474227649511, 7.81676325321851, 7.71940521069487, 7.67181853053348,
8.33880996371242, 7.21094058581954, 8.03822762707727, 7.82261070201569,
7.82357158274152, 7.83735667738348, 8.1046367156374, 7.80815635609445,
7.76703032589162, 7.89220083728877, 7.83855143477394, 7.5073939335162,
8.37816256879826, 7.5059752001373, 8.15552853001404, 7.99048020502086,
7.87268970278342, 7.90447413791873, 8.36780891138641, 8.01981945164711,
7.98025535548044, 8.17482965571992, 8.03312420507814, 8.1396225979523,
8.53154436348939, 8.30064119442864, 8.31217764468587, 8.46515718841819,
8.29227902146296, 8.37957956757638, 8.77038284745496, 8.38757448056262,
8.42970131889157, 8.55673020197898, 7.94125019923153, 7.6879198778969,
9.45050056056844, 8.49521672781314, 8.5173342801255, 8.79041321175791,
8.62481679196763, 8.6089805031612, 9.02875849754497, 8.71206191409011,
8.70162108392494, 8.71428574579492, 8.73089101876822, 8.78844251470506,
9.20696012451967, 6.5096550774221, 9.31509857797606, 9.13789797374865,
8.81392733764639, 8.85674985041305, 9.24914586810566, 7.91025892946504,
9.3832351526754, 9.0349150142277, 9.07250596538971, 8.99441603776387,
9.53980564522775, 8.88032246234735, 9.0418287190433, 9.32660204283357,
9.10057585013137, 9.08539025332009, 9.49154546126259, 9.14507434057652,
9.15862717595491, 9.34371391025786, 9.23770140195837, 9.331902300461,
9.84529784537339, 9.22652292064231, 9.36711817060034, 9.45464102264676,
9.43080717829243, 9.48542815127549, 9.80315392429245, 9.46220102483428,
9.49195605787191, 9.58345398545618, 9.63034810064769, 9.62459170291441,
9.97734143922148, 7.7599692507259, 10.24019393111, 9.83720243907435,
9.76324132919314, 9.80448476069629, 10.1429407688952, 9.78954063027604,
9.81148978580127, 9.90999022870695, 9.88337955430856, 9.86638017850479,
10.3500614614058, 8.04569598345531, 10.5137723520267, 10.0317143144973,
10.0016019420988, 10.0649053768744, 10.4518094727319, 10.0925802568863,
10.1154740580661, 10.2417047261218, 10.2102565428829, 9.95096958506337,
10.736142313028, 10.2104846692811, 10.0464027137144, 10.4566501947458,
10.213399969191, 10.4108390826055, 10.7497332163144, 10.3922428157884,
10.3629994803926, 10.5490843518049, 10.5299430900147, 10.5342652815607,
10.903442654213, 10.523826123055, 9.94829558655345, 11.0676534061714,
10.7289541973848, 10.7146558087789, 11.1095150342409, 10.7975434766392,
10.8030323275495, 10.9150557366667, 10.8468764795822, 10.1911966896029,
11.575751749895, 10.8395599835383, 10.9068704738973, 11.155501263489,
11.0291969763111, 11.0962769537602, 11.4469279398172, 11.0612218040278,
11.1062426423224, 11.2517538845846, 11.2333784859651, 10.9841022587667,
11.7991470802475, 11.2598050882812, 11.254649905487, 11.4720292631746,
11.3598860229692, 11.4170427738813, 11.766391720184, 11.4134853828265,
11.4410605118049, 11.5576389232754, 11.5626475736127, 11.5282047555652,
11.9147793383982, 11.4669389639854, 11.5920019692809, 11.7656439584139,
11.5489709584581, 11.6145933534541, 12.0526884789762, 11.5721225093198,
11.5785294086931, 11.9478679038354, 11.7577088515946, 11.644026901156,
12.282699606583, 11.6893399093708, 11.7081194573217, 12.0745898194066,
11.8513909555241, 12.0120697218447, 12.3777829279197, 11.9427908749701,
11.9852440709239, 12.2849763358503, 12.1610242572971, 12.2863478497246,
12.6987948609176, 8.87626014701704, 8.75781187913873, 8.79677757108755,
8.86048921162718, 9.42285091166665, 9.15587149508903, 9.07157541184028,
9.04422296009634, 8.98415367463587, 8.99264229713128, 8.99995926865439,
8.98630888588454, 9.08279027699937, 9.01801415653217, 9.03092644682495,
9.13585333120665, 9.3964555249613, 9.31056129804753, 9.21149824677136,
9.23582853002755, 9.19896921092407, 9.1993094115266, 9.22157244245253,
9.33255711303986, 9.32050974348142, 9.25734511507957, 9.25346237744606,
9.21161756310925, 9.57206242922829, 9.53477519401849, 9.44848135105606,
9.4736925056348, 9.45353618677624, 9.50006144281617, 9.53134203318552,
9.55522920290037, 9.58433205464551, 9.49975115996635, 9.54279990568933,
9.4939629665153, 9.8456088597159, 9.80015328006924, 9.76821638323259,
9.79109456264224, 9.72522763542793, 9.77851709053319, 9.8204171003855,
9.88434452165958, 9.98640258678757, 9.88349657543331, 9.78072105929449,
9.91545274615568, 10.0965440644382, 10.069889220858, 10.1071834236742,
10.0960053864793, 10.0816170924409, 10.0972659507375, 9.98273573064832,
10.0707648293296, 10.0903422031634, 10.0334967498009, 9.988071454218,
10.0452755646408, 10.214325988114, 10.1943936821307, 10.20408926276,
10.1374653682538, 10.1747246925649, 10.1817608649851, 10.1694093867828,
10.2457147073325, 10.2759167729448, 10.2174707468632, 10.2579653028569,
10.3132625062745, 10.5801172770154, 10.5266233798438, 10.5287486381328,
10.4503144592933, 10.481479184849, 10.4934241207427, 10.502542901769,
10.5494285881606, 10.6156346275554, 10.5119074689424, 10.5311093136153,
10.5900727521127, 10.832499150024, 10.7930060469324, 10.775718578877,
10.7531531154054, 10.773311204382, 10.7696395290979, 10.7637570976447,
10.7977938807946, 10.8750990746633, 10.763894326936, 10.7864939948099,
10.8084313558315, 11.0190608163543, 10.9799244653747, 11.0238093735289,
11.0096646409103, 10.9573562063908, 11.0042746906925, 11.0131160377438,
11.0384446615171, 11.0925921149442, 11.016788345678, 11.0067286524726,
11.1218140056974, 11.2613143806394, 11.2211796761646, 11.2935015874788,
11.2367103049134, 11.1817094995799, 11.2157604633905, 11.2061686914688,
11.2392748154291, 11.4109721102435, 11.3043371225574, 11.2735248395737,
11.4375261360429, 11.5623874976603, 11.5247175044255, 11.5814242903823,
11.5093986724378, 11.5000330452891, 11.5579600619228, 11.5311240131655,
11.5954153362326, 11.6738399129326, 11.57644340322, 11.5655204319799,
11.6321174901907, 11.8360148309349, 11.8553639635506, 11.8913520673329,
11.7944527780615, 11.770991474902, 11.8087026529826, 11.7713523360005,
11.884723151518, 11.9993814545919, 11.8115717892501, 11.8332855179777,
11.9237740730483, 12.0455787827743, 12.0702342014546, 12.1012197983564,
12.0183149296719, 12.0336059065465, 12.0269239230024, 12.1132590047525,
12.5264959691571, 12.2615706812812, 12.0565371292502, 12.2657313524817,
12.1439258858968, 12.2359003050756, 12.3309092088311, 12.3771893569204,
12.3071632432092, 12.3196939443778, 12.3000789109455, 12.321469532421,
12.3683550017493, 12.4759510736235, 12.3701719620075, 12.3835321964786,
12.372549767611, 12.5961565138223, 12.6077080727407, 12.5909743980745,
12.5893548765137, 12.5974984744602, 12.6523879936874, 12.6119355657399,
12.6758307918205, 12.8047085707425, 12.7095434517684, 12.7003715885686,
12.7865053255695, 13.0041421782442, 13.0268258741114, 13.0190226032443,
13.0357037893755, 12.9527882182394, 13.0084592868531, 13.0707965999479,
13.1069788399601, 1.04885832686158, 1.06016074629379, 1.0517956106758,
1.02907998600003, 1.05054370620123, 1.07261670636915, 1.0706491823234,
1.0851355199628, 1.08488055975672, 1.08085233559646, 1.081489249884,
1.08587205516048, 1.07249155362154, 1.05497731364761, 1.05675866316574,
1.06428371643968, 1.06065865122313, 1.05621234529568, 1.05339905298902,
1.05787030302435, 1.0658034000068, 1.08707776713932, 1.08626056161822,
1.10238697375394, 1.11390088086972, 1.12120513732074, 1.11937921359653,
1.10341241626668, 1.1156190247407, 1.12376155972358, 1.12411603174635,
1.12183475077377, 1.12994175229071, 1.12956170931204, 1.12199732095331,
1.11645064755987, 1.12481242467782, 1.13066151473637, 1.13028712061827,
1.12694056065497, 1.12382226475179, 1.12352013167586, 1.13391069257413,
1.14763982976838, 1.14481816405703, 1.14852949174863, 1.14182560351963,
1.14086563926171, 1.14491904045717, 1.14897189333479, 1.14616964486707,
1.15074750127031, 1.14681353487065, 1.11151754535415, 1.10497749493861,
1.10963378437214, 1.12415745716768, 1.17507535290893, 1.20285968503846,
1.22784769136553, 1.23940795216891, 1.254741010879, 1.29442450660416,
1.30428779451896, 1.31314618462517, 1.32544236970695, 1.33728107423435,
1.34408499591568, 1.34199331033196, 1.34027541040719, 1.33616830504407,
1.33360421057602, 1.33332422301893, 1.34717794252774, 1.3502492092262,
1.35168291803248, 1.35827816606688, 1.36772644852242, 1.36755741578293,
1.36926148542701, 1.37264481021763, 1.37322962601678, 1.37643913938007,
1.37906284181634, 1.37644362054554, 1.38911039237937, 1.39412557349575,
1.40094895608589, 1.40630864159528, 1.40823485306921, 1.4138446752069,
1.42340582796496, 1.43641264727375, 1.43605231080207, 1.44839810240334,
1.45451041581127, 1.46166006472498, 1.46774816064695, 1.46930608347752,
1.47885183796249, 1.49059366171423, 1.49849145403671, 1.51209667142067,
1.5250141727637, 1.5392257264567, 1.55144303632514, 1.56488453313021,
1.58308777691125, 1.59737589266492, 1.60896279958586, 1.62553339664661,
1.63594174408691, 1.65233080464302, 1.67114336171075, 1.6897476078746,
1.71673790971729, 1.74453973794979, 1.76317526009814, 1.79187692264759,
1.84186982937622, 1.9460629324144, 2.05986108970089, 2.06767436493269,
2.0783176148561, 2.08271855277262, 2.09358626977224, 2.09674958523685,
2.11582742548029, 2.12810020369675, 2.13596929171732, 2.13972610568317,
2.14456803530813, 2.15013985201827, 2.16007349878874, 2.17165498940627,
2.18057666565755, 2.19162746118342, 2.20308765886345, 2.21304799942168,
2.22367586966847, 2.23629862083737, 2.24751866055731, 2.26100586740225,
2.40972893063106, 2.60366275683037, 2.68572993101095, 2.70501080420283,
2.6676315643757, 2.6479269687206, 2.64641010174172, 2.69966594490103,
2.69665303568271, 2.71396750774502, 2.71900427132191, 2.72876269360869,
2.76276620421252, 2.76620189252239, 2.74632816231219, 2.74196673817286,
2.72905831066292, 2.75190757584346, 2.77801573354251, 2.84089580821293,
2.85681823660541, 2.84754572013613, 2.85858396073969, 2.86184353545653,
2.86958309986952, 2.94279115543111, 2.98631808884879, 3.00648449252989,
3.00620698598987, 3.15207693676406, 3.27614511764022, 3.32011714920345,
3.39367422894347, 3.64822360464499, 3.61835354049394, 3.59374251055335,
3.63237359915986, 3.62209957896007, 3.64554153297999, 3.71611226971083,
3.76031231050606, 3.80307769833913, 3.77959145461296, 3.74772344909971,
3.95072671083008, 4.03652777624058, 4.06630193640976, 4.08838169421096,
4.09074775372752), .Dim = c(192L, 7L), .Dimnames = list(NULL,
c("EMBI+", "M2 (pesos)", "Commodity Price index", "emae",
"gasto programas SS", "recursos tributarios", "ex_rate")), .Tsp = c(2004,
2019.91666666667, 12), class = c("mts", "ts", "matrix"))

commands to find Avg, Max, Min in DF

I need to show the unique Count by Url and then show the Avg, Max, Min time that it took as different columns. Was looking at using either dplyr or sqldf.
here is what I am essentially trying to duplicate
SELECT cs-uri-stem as Url, COUNT(*) as totalRequests,
AVG(time-taken) As avgRequestDuration,
MAX(time-taken) As maxRequestDuration,
MIN(time-taken) As minRequestDuration
FROM '[LOGFILEPATH]'
GROUP BY Url
ORDER By totalRequests DESC
Head of data for reference:
> head(iislog1)
iisdate iistime csUriStem timeTaken
1 2019-05-17 03:05:39 /eACommon/SystemConfigurationService.svc/customBinding 7421
2 2019-05-17 03:07:22 /Services/2015V1/EngService.svc/customBinding 8390
3 2019-05-17 03:16:40 /eACommon/SystemConfigurationService.svc/customBinding 515
4 2019-05-17 03:17:39 /eACommon/SystemConfigurationService.svc/customBinding 505
5 2019-05-17 03:25:22 /Services/2015V1/EngService.svc/customBinding 1385
6 2019-05-17 03:31:16 /eAudIT/Services/SAPv1/EngService.svc/customBinding 1365
structure(list(iisdate = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = "2019-05-17", class = "factor"),
iistime = structure(1:6, .Label = c("03:05:39", "03:07:22",
"03:16:40", "03:17:39", "03:25:22", "03:31:16", "03:44:02",
"04:27:09", "04:27:11", "04:27:19", "04:27:20", "04:27:22",
"04:27:30", "04:27:33", "04:27:36", "04:27:40", "04:27:42",
"04:27:43", "04:27:44", "04:27:45", "04:27:46", "04:27:47",
"04:27:48", "04:27:50", "04:27:51", "04:27:55", "04:27:57",
"04:28:00", "04:28:01", "04:28:02", "04:28:03", "04:28:05",
"04:28:06", "04:28:08", "04:28:10", "04:28:19", "04:28:26",
"04:28:27", "04:28:28", "04:28:29", "04:28:32", "04:28:37",
"04:28:50", "04:28:51", "04:28:53", "04:28:54", "04:28:55",
"04:28:56", "04:28:57", "04:29:00", "04:29:16", "04:29:18",
"04:29:19", "04:29:20", "04:29:21", "04:29:23", "04:29:24",
"04:29:25", "04:29:26", "04:29:29", "04:29:30", "04:29:33",
"04:29:35", "04:29:37", "04:29:38", "04:30:27", "04:30:29",
"04:30:31", "04:30:32", "04:30:40", "04:30:43", "04:30:58",
"04:31:00", "04:31:01", "04:31:02", "04:31:04", "04:31:08",
"04:31:46", "04:31:47", "04:31:48", "04:31:49", "04:31:54",
"04:31:55", "04:31:56", "04:31:58", "04:31:59", "04:32:01",
"04:32:02", "04:32:03", "04:32:04", "04:32:05", "04:32:06",
"04:32:08", "04:32:09", "04:32:11", "04:32:12", "04:32:14",
"04:32:15", "04:32:17", "04:32:20", "04:32:27", "04:32:39",
"04:32:41", "04:32:42", "04:32:45", "04:32:58", "04:33:03",
"04:33:04", "04:33:08", "04:33:10", "04:33:11", "04:33:12",
"04:33:14", "04:33:15", "04:33:17", "04:33:18", "04:33:41",
"04:33:42", "04:33:44", "04:33:49", "04:33:50", "04:33:51",
"04:33:52", "04:33:53", "04:33:55", "04:33:57", "04:33:58",
"04:34:00", "04:34:02", "04:34:04", "04:34:05", "04:34:07",
"04:34:08", "04:34:10", "04:34:12", "04:34:15", "04:34:16",
"04:34:18", "04:34:25", "04:34:28", "04:34:39", "04:34:40",
"04:34:42", "04:34:43", "04:34:46", "04:34:51", "04:34:57",
"04:34:58", "04:35:01", "04:35:02", "04:35:10", "04:35:13",
"04:35:14", "04:35:15", "04:35:16", "04:35:17", "04:35:19",
"04:35:20", "04:35:21", "04:35:22", "04:35:24", "04:35:25",
"04:35:27", "04:35:29", "04:35:30", "04:35:31", "04:35:34",
"04:35:35", "04:35:38", "04:35:40", "04:35:49", "04:36:01",
"04:36:02", "04:36:05", "04:36:26", "04:36:28", "04:36:29",
"04:36:31", "04:36:32", "04:36:33", "04:36:36", "04:36:41",
"04:36:42", "04:36:43", "04:36:44", "04:36:45", "04:36:47",
"04:36:49", "04:36:51", "04:36:53", "04:36:54", "04:36:55",
"04:36:56", "04:36:57", "04:36:58", "04:37:00", "04:37:01",
"04:37:02", "04:37:04", "04:37:07", "04:37:11", "04:37:16",
"04:37:29", "04:37:30", "04:37:31", "04:37:33", "04:37:35",
"04:38:08", "04:38:09", "04:38:17", "04:38:18", "04:38:19",
"04:38:23", "04:38:24", "04:38:25", "04:38:27", "04:38:28",
"04:38:29", "04:38:30", "04:38:31", "04:38:32", "04:38:34",
"04:38:35", "04:38:36", "04:38:41", "04:38:42", "04:38:43",
"04:39:14", "04:39:15", "04:39:16", "04:39:17", "04:39:19",
"04:39:30", "04:39:31", "04:39:44", "04:39:45", "04:39:46",
"04:39:48", "04:39:50", "04:40:00", "04:40:01", "04:40:03",
"04:40:06", "04:40:07", "04:40:08", "04:40:09", "04:40:11",
"04:40:12", "04:40:13", "04:40:14", "04:40:16", "04:40:19",
"04:40:20", "04:40:22", "04:40:24", "05:00:45", "05:07:01",
"05:07:03", "05:07:05", "05:07:35", "05:07:36", "05:07:38",
"05:07:39", "05:07:42", "05:07:44", "05:07:45", "05:07:46",
"05:07:49", "05:08:04", "05:08:05", "05:08:06", "05:08:07",
"05:08:08", "05:08:09", "05:08:10", "05:08:11", "05:08:24",
"05:08:30", "05:08:31", "05:08:37", "05:08:38", "05:08:39",
"05:08:40", "05:08:52", "05:08:58", "05:08:59", "05:09:02",
"05:09:03", "05:11:50", "05:11:52", "05:11:53", "05:11:59",
"05:12:00", "05:12:01", "05:12:02", "05:12:03", "05:12:04",
"05:12:06", "05:12:07", "05:12:08", "05:12:09", "05:12:10",
"05:12:11", "05:13:46", "05:13:47", "05:13:48", "05:13:50",
"05:13:51", "05:13:53", "05:13:55", "05:13:56", "05:13:59",
"05:14:05", "05:14:07", "05:14:08", "05:14:10", "05:14:11",
"05:14:12", "05:14:14", "05:14:16", "05:14:18", "05:14:19",
"05:14:20", "05:14:21", "05:14:22", "05:14:24", "05:14:25",
"05:14:27", "05:14:28", "05:14:29", "05:14:30", "05:14:31",
"05:14:32", "05:14:33", "05:14:34", "05:14:36", "05:14:37",
"05:14:38", "05:14:39", "05:14:40", "05:14:41", "05:14:42",
"05:14:43", "05:14:44", "05:14:45", "05:14:46", "05:14:47",
"05:14:48", "05:14:50", "05:14:51", "05:14:52", "05:14:54",
"05:14:55", "05:14:56", "05:14:57", "05:14:58", "05:14:59",
"05:15:00", "05:15:01", "05:15:02", "05:15:03", "05:15:04",
"05:15:06", "05:15:07", "05:15:08", "05:15:09", "05:15:10",
"05:15:11", "05:15:12", "05:15:13", "05:15:15", "05:15:16",
"05:15:17", "05:15:18", "05:15:19", "05:15:20", "05:15:21",
"05:15:22", "05:15:24", "05:15:25", "05:15:26", "05:15:27",
"05:15:28", "05:15:29", "05:15:31", "05:15:32", "05:15:33",
"05:15:34", "05:15:35", "05:15:36", "05:15:37", "05:15:38",
"05:15:39", "05:15:40", "05:15:41", "05:15:42", "05:15:43",
"05:15:44", "05:15:45", "05:15:46", "05:15:48", "05:15:49",
"05:15:50", "05:15:51", "05:15:52", "05:15:53", "05:15:54",
"05:15:55", "05:15:56", "05:15:57", "05:15:58", "05:15:59",
"05:16:00", "05:16:01", "05:16:03", "05:16:04", "05:16:05",
"05:16:06", "05:16:07", "05:16:09", "05:16:10", "05:16:11",
"05:16:12", "05:16:13", "05:16:14", "05:16:15", "05:16:17",
"05:16:19", "05:16:21", "05:16:22", "05:16:23", "05:16:24",
"05:16:25", "05:16:26", "05:16:28", "05:16:29", "05:16:30",
"05:16:31", "05:16:32", "05:16:34", "05:16:35", "05:16:36",
"05:16:37", "05:16:38", "05:16:39", "05:16:41", "05:16:42",
"05:16:43", "05:16:44", "05:16:45", "05:16:47", "05:16:54",
"05:17:13", "05:17:14", "05:17:15", "05:17:16", "05:17:18",
"05:17:19", "05:17:20", "05:17:21", "05:17:22", "05:17:23",
"05:17:25", "05:21:37", "05:21:39", "05:21:40", "05:21:42",
"05:21:44", "05:21:48", "05:21:54", "05:21:55", "05:21:57",
"05:21:58", "05:21:59", "05:22:00", "05:22:01", "05:22:02",
"05:22:03", "05:22:05", "05:22:06", "05:22:07", "05:22:08",
"05:22:09", "05:22:10", "05:22:11", "05:22:12", "05:22:14",
"05:22:15", "05:22:18", "05:22:21", "05:31:23", "05:31:24",
"05:31:26", "05:31:27", "05:31:28", "05:31:29", "05:31:31",
"05:31:34", "05:31:39", "05:31:57", "05:31:58", "05:31:59",
"05:32:01", "05:32:02", "05:32:03", "05:38:29", "05:38:32",
"05:39:08", "05:39:09", "05:39:10", "05:39:11", "05:39:12",
"05:39:14", "05:39:15", "05:39:28", "05:41:58", "05:42:00",
"05:42:02", "05:42:05", "05:42:07", "05:42:08", "05:42:09",
"05:42:11", "05:42:12", "05:42:13", "05:52:15", "05:52:16",
"05:52:17", "05:52:18", "05:52:20", "05:52:24", "05:52:26",
"05:52:53", "05:53:06", "05:53:08", "05:53:09", "05:55:21",
"05:55:23", "05:55:24", "05:55:25", "05:55:27", "05:55:28",
"05:55:29", "05:55:30", "05:55:31", "05:55:33", "06:17:42",
"06:17:44", "06:17:49", "06:18:03", "06:18:04", "06:18:06",
"06:18:08", "06:18:10", "06:18:11", "06:18:13", "06:18:14",
"06:18:15", "06:18:18", "06:18:19", "06:18:21", "06:18:22",
"06:18:23", "06:18:24", "06:18:25", "06:18:26", "06:18:28",
"06:18:30", "06:18:31", "06:18:33", "06:18:35", "06:18:43",
"06:18:44", "06:18:46", "06:18:48", "06:18:49", "06:18:51",
"06:18:53", "06:18:54", "06:18:55", "06:18:58", "06:19:00",
"06:19:02", "06:19:03", "06:19:04", "06:19:09", "06:19:14",
"06:19:15", "06:19:16", "06:19:18", "06:19:19", "06:19:20",
"06:19:22", "06:19:23", "06:19:25", "06:19:26", "06:19:28",
"06:19:30", "06:19:31", "06:19:32", "06:19:44", "06:19:48",
"06:19:49", "06:19:50", "06:19:51", "06:19:53", "06:19:54",
"06:19:56", "06:19:57", "06:19:58", "06:20:00", "06:20:01",
"06:20:05", "06:20:06", "06:21:02", "06:21:04", "06:21:05",
"06:21:08", "06:21:12", "06:21:29", "06:21:30", "06:21:32",
"06:22:05", "06:22:06", "06:24:45", "06:24:47", "06:24:51",
"06:24:53", "06:24:56", "06:24:57", "06:24:58", "06:25:00",
"06:25:02", "06:25:03", "06:25:04", "06:25:05", "06:25:06",
"06:25:10", "06:25:13", "06:25:15", "06:25:16", "06:25:18",
"06:25:19", "06:25:23", "06:25:27", "06:25:38", "06:25:39",
"06:25:41", "06:27:16", "06:27:17", "06:31:27", "06:31:28",
"06:31:29", "06:31:30", "06:31:32", "06:31:33", "06:31:34",
"06:31:35", "06:31:37", "06:31:38", "06:31:39", "06:31:40",
"06:31:41", "06:31:42", "06:31:43", "06:31:44", "06:31:45",
"06:31:47", "06:31:48", "06:31:49", "06:31:50", "06:31:51",
"06:31:52", "06:31:53", "06:31:54", "06:31:55", "06:31:57",
"06:31:58", "06:31:59", "06:32:00", "06:32:01", "06:32:02",
"06:32:03", "06:32:04", "06:32:05", "06:32:06", "06:32:08",
"06:32:09", "06:32:10", "06:32:11", "06:32:12", "06:32:13",
"06:32:15", "06:37:17", "06:37:19", "06:37:20", "06:37:22",
"06:37:23", "06:37:24", "06:37:26", "06:37:27", "06:37:28",
"06:37:29", "06:37:41", "06:37:42", "06:37:47", "06:37:49",
"06:37:50", "06:37:51", "06:37:52", "06:37:53", "06:37:58",
"06:37:59", "06:40:11", "06:40:13", "06:40:14", "06:40:15",
"06:40:16", "06:40:18", "06:40:19", "06:40:20", "06:40:21",
"06:40:22", "06:40:23", "06:40:24", "06:40:25", "06:40:26",
"06:40:50", "06:40:51", "06:40:52", "06:40:53", "06:40:54",
"06:40:56", "06:40:57", "06:40:59", "06:41:01", "06:41:04",
"06:41:17", "06:41:18", "06:41:40", "06:42:43", "06:42:45",
"06:48:50", "06:48:51", "06:49:10", "06:49:12", "06:49:14",
"06:50:21", "06:50:22", "06:50:31", "06:50:32", "06:50:33",
"06:50:44", "06:50:45", "06:52:37", "06:52:38", "06:52:39",
"06:56:39", "06:56:41", "06:56:43", "06:59:16", "06:59:18",
"06:59:19", "06:59:22", "06:59:23", "06:59:24", "06:59:25",
"06:59:27", "06:59:28", "06:59:29", "06:59:30", "07:02:50",
"07:02:52", "07:02:54", "07:02:55", "07:02:56", "07:02:58",
"07:02:59", "07:03:00", "07:06:52", "07:06:54", "07:06:56",
"07:06:57", "07:06:58", "07:07:00", "07:07:02", "07:07:04",
"07:07:05", "07:07:06", "07:07:07", "07:09:38", "07:09:39",
"07:35:15", "07:35:18", "07:35:20", "07:35:23", "07:35:25",
"07:35:26", "07:35:27", "07:35:28", "07:35:29", "07:35:30",
"07:35:32", "07:35:33", "07:35:35", "07:35:36", "07:35:37",
"07:35:38", "07:35:39", "07:35:40", "07:35:41", "07:36:44",
"07:37:09", "07:37:33", "07:37:58", "07:38:23", "07:46:13",
"08:33:43", "08:33:47", "08:33:50", "08:33:58", "08:34:01",
"08:34:02", "08:34:04", "08:34:05", "08:34:06", "08:34:07",
"08:34:09", "08:34:14", "08:34:15", "08:34:28", "08:34:30",
"08:34:31", "08:34:32", "08:34:33", "08:34:34", "08:34:36",
"08:34:37", "08:34:38", "08:34:39", "08:34:40", "08:34:47",
"08:34:49", "08:34:55", "08:34:56", "08:34:57", "08:34:58",
"08:34:59", "08:35:00", "08:35:05", "08:35:06", "08:35:08",
"08:35:11", "08:35:12", "08:35:13", "08:35:15", "08:35:17",
"08:35:18", "08:35:20", "08:35:21", "08:35:23", "08:35:25",
"08:35:37", "08:35:38", "08:35:39", "08:35:40", "08:35:41",
"08:35:42", "08:35:43", "08:59:09", "08:59:12", "08:59:13",
"08:59:15", "09:00:56", "09:00:57", "09:00:59", "09:01:00",
"09:01:02", "09:01:21", "09:22:31", "09:22:34", "09:22:51",
"09:22:53", "09:22:54", "09:22:55", "09:22:57", "09:22:58",
"09:22:59", "09:23:00", "09:23:01", "09:23:02", "09:23:03",
"09:23:04", "09:23:05", "09:23:06", "09:23:07", "09:23:08",
"09:23:10", "09:23:11", "09:23:12", "09:23:16", "09:23:17",
"09:23:18", "09:23:19", "09:23:24", "09:23:26", "09:23:29",
"09:23:30", "09:23:31", "09:23:32", "09:23:33", "09:23:36",
"09:23:37", "09:23:38", "09:23:43", "09:23:45", "09:23:46",
"09:23:48", "09:23:49", "09:23:50", "09:23:51", "09:23:52",
"09:23:53", "09:23:55", "09:23:56", "09:23:57", "09:23:58",
"09:24:01", "09:24:03", "09:24:04", "09:24:06", "09:24:07",
"09:24:10", "09:24:11", "09:24:13", "09:24:14", "09:24:15",
"09:24:16", "09:24:17", "09:24:18", "09:24:19", "09:24:20",
"09:24:21", "09:24:23", "09:24:24", "09:24:25", "09:24:26",
"09:24:27", "09:24:29", "09:24:30", "09:24:31", "09:24:32",
"09:24:33", "09:24:34", "09:24:35", "09:24:37", "09:24:38",
"09:24:39", "09:24:40", "09:24:41", "09:24:42", "09:24:43",
"09:24:44", "09:24:45", "09:24:46", "09:24:48", "09:24:49",
"09:24:50", "09:24:51", "09:24:52", "09:24:53", "09:24:55",
"09:24:56", "09:24:57", "09:24:58", "09:25:00", "09:25:01",
"09:25:02", "09:25:03", "09:25:04", "09:25:06", "09:25:07",
"09:25:08", "09:25:09", "09:25:10", "09:25:12", "09:25:13",
"09:25:14", "09:25:15", "09:25:16", "09:25:17", "09:25:18",
"09:25:19", "09:25:29", "09:25:32", "09:25:34", "09:25:45",
"09:25:47", "09:25:48", "09:25:50", "09:25:52", "09:25:53",
"09:25:55", "09:25:56", "09:26:01", "09:26:14", "09:26:16",
"09:26:17", "09:26:19", "09:26:21", "09:26:22", "09:26:24",
"09:26:25", "09:26:26", "09:26:29", "09:26:30", "09:26:35",
"09:26:36", "09:26:37", "09:26:39", "09:26:42", "09:26:45",
"09:26:47", "09:26:48", "09:26:53", "09:26:55", "09:26:57",
"09:26:58", "09:26:59", "09:27:01", "09:27:04", "09:27:06",
"09:27:09", "09:27:12", "09:27:13", "09:27:14", "09:27:16",
"09:27:17", "09:27:18", "09:27:19", "09:27:20", "09:27:21",
"09:27:23", "09:27:24", "09:27:25", "09:27:26", "09:27:27",
"09:27:28", "09:27:29", "09:27:30", "09:27:31", "09:27:32",
"09:27:33", "09:27:34", "09:27:35", "09:27:36", "09:27:37",
"09:27:39", "09:27:40", "09:27:41", "09:27:42", "09:27:43",
"09:27:44", "09:27:45", "09:27:46", "09:27:47", "09:27:48",
"09:27:49", "09:27:51", "09:27:52", "09:27:53", "09:27:54",
"09:27:55", "09:27:56", "09:27:57", "09:27:58", "09:28:00",
"09:28:01", "09:28:03", "09:28:04", "09:28:05", "09:28:07",
"09:28:08", "09:28:10", "09:28:16", "09:28:18", "09:28:21",
"09:28:22", "09:28:24", "09:28:25", "09:28:26", "09:28:27",
"09:28:28", "09:28:34", "09:28:35", "09:28:36", "09:28:37",
"09:28:38", "09:28:39", "09:28:41", "09:28:42", "09:28:44",
"09:28:45", "09:28:46", "09:28:47", "09:28:48", "09:28:49",
"09:28:50", "09:28:52", "09:28:53", "09:28:54", "09:28:55",
"09:28:56", "09:28:58", "09:29:01", "09:29:03", "09:29:04",
"09:29:06", "09:29:13", "09:29:29", "09:29:30", "09:29:33",
"09:29:34", "09:29:36", "09:30:25", "09:30:26", "09:30:29",
"09:30:30", "09:30:31", "09:30:36", "09:30:48", "09:30:50",
"09:31:45", "09:31:47", "09:31:50", "09:31:52", "09:31:54",
"09:31:55", "09:31:57", "09:31:59", "09:32:01", "10:00:52",
"10:00:55", "10:00:57", "10:00:59", "10:01:00", "10:01:01",
"10:01:03", "10:01:04", "10:01:05", "10:01:06", "10:01:07",
"10:01:08", "10:01:51", "10:01:52", "10:02:01", "10:02:02",
"10:02:03", "10:02:04", "10:02:05", "10:02:07", "10:02:17",
"10:02:22", "10:02:24", "10:02:25", "10:02:26", "10:02:27",
"10:02:28", "10:02:29", "10:02:31", "10:02:32", "10:02:38",
"10:02:39", "10:02:40", "10:02:42", "10:02:43", "10:02:58",
"10:03:00", "10:04:24", "10:04:27", "10:04:29", "10:04:31",
"10:04:32", "10:04:33", "10:04:35", "10:04:41", "10:04:42",
"10:04:43", "10:04:44", "10:04:45", "10:04:46", "10:04:47",
"10:04:48", "10:04:49", "10:04:50", "10:04:55", "10:05:03",
"10:05:05", "10:05:06", "10:05:07", "10:05:08", "10:05:09",
"10:05:10", "10:05:27", "10:05:29", "10:05:30", "10:05:31",
"10:05:32", "10:05:41", "10:05:43", "10:06:13", "10:06:14",
"10:06:15", "10:07:31", "10:07:32", "10:08:39", "10:08:41",
"10:08:52", "10:12:47", "10:12:49", "10:12:50", "10:12:52",
"10:12:54", "10:12:56", "10:12:58", "10:13:17", "10:13:18",
"10:13:19", "10:13:21", "10:13:23", "10:13:24", "10:13:25",
"10:13:26", "10:13:28", "10:13:29", "10:13:30", "10:13:33",
"10:13:36", "10:13:40", "10:13:41", "10:13:43", "10:13:44",
"10:13:46", "10:13:49", "10:13:58", "10:14:08", "10:14:09",
"10:14:11", "10:14:12", "10:14:14", "11:30:02", "11:30:03",
"11:30:04", "11:30:06", "11:30:08", "11:30:10", "11:30:12",
"11:30:15", "11:30:17", "11:30:18", "11:30:19", "11:30:23",
"11:30:24", "11:30:26", "11:30:27", "11:30:28", "11:30:29",
"11:30:31", "11:30:33", "11:30:35", "11:30:38", "11:30:39",
"11:30:42", "11:31:03", "11:31:04", "11:31:05", "11:31:22",
"11:31:27", "11:31:28", "11:31:31", "11:31:32", "11:31:34",
"11:31:36", "11:31:38", "11:32:09", "11:32:11", "11:32:13",
"11:32:15", "11:32:16", "11:32:18", "11:32:19", "11:32:20",
"11:32:22", "11:32:23", "11:32:24", "11:32:26", "11:32:28",
"11:32:31", "11:32:35", "11:32:36", "11:32:38", "11:32:51",
"11:32:53", "11:33:27", "11:33:34", "11:33:35", "11:33:36",
"11:33:37", "11:33:39", "11:33:43", "11:33:45", "11:33:46",
"11:33:48", "11:33:49", "11:33:51", "11:33:52", "11:33:53",
"11:33:55", "11:33:56", "11:33:59", "11:34:02", "11:34:03",
"11:34:04", "11:34:07", "11:34:08", "11:34:09", "11:34:19",
"11:34:37", "11:34:38", "11:34:49", "11:34:50", "11:34:55",
"11:34:56", "11:34:59", "11:35:00", "11:35:02", "11:35:05",
"11:35:06", "11:35:14", "11:35:28", "11:35:30", "11:35:43",
"11:35:45", "11:35:46", "11:35:47", "11:35:48", "11:35:50",
"11:35:56", "11:35:59", "11:36:01", "11:36:20", "11:36:21",
"11:36:23", "11:36:24", "11:36:25", "11:36:26", "11:36:27",
"11:36:50", "11:36:51", "11:36:58", "11:36:59", "11:37:00",
"11:37:01", "11:37:02", "11:37:03", "11:37:04", "11:37:05",
"11:37:16", "11:37:22", "11:37:23", "11:37:24", "11:37:26",
"11:37:27", "11:37:30", "11:37:31", "11:37:33", "11:37:35",
"11:37:37", "11:37:40", "11:37:42", "11:37:45", "11:37:51",
"11:37:53", "11:37:54", "11:37:56", "11:37:57", "11:37:59",
"11:38:02", "11:38:03", "11:38:05", "11:38:06", "11:38:07",
"11:38:08", "11:38:10", "11:38:11", "11:38:12", "11:38:13",
"11:38:14", "11:38:15", "11:38:16", "11:38:17", "11:38:18",
"11:38:19", "11:38:21", "11:38:22", "11:38:23", "11:38:24",
"11:38:25", "11:38:26", "11:38:27", "11:38:28", "11:38:30",
"11:38:31", "11:38:32", "11:38:33", "11:38:34", "11:38:35",
"11:38:36", "11:38:37", "11:38:38", "11:38:39", "11:38:41",
"11:38:42", "11:38:43", "11:38:44", "11:38:45", "11:38:46",
"11:38:47", "11:38:48", "11:38:50", "11:38:51", "11:38:52",
"11:38:53", "11:38:54", "11:38:55", "11:38:56", "11:38:57",
"11:38:58", "11:38:59", "11:39:00", "11:39:02", "11:39:03",
"11:39:04", "11:39:05", "11:39:06", "11:39:07", "11:39:09",
"11:39:10", "11:39:11", "11:39:12", "11:39:13", "11:39:14",
"11:39:15", "11:39:16", "11:39:17", "11:39:18", "11:39:20",
"11:39:21", "11:39:22", "11:39:23", "11:39:24", "11:39:25",
"11:39:26", "11:39:28", "11:39:29", "11:39:30", "11:39:31",
"11:39:32", "11:39:33", "11:39:34", "11:39:35", "11:39:36",
"11:39:37", "11:39:38", "11:39:39", "11:39:40", "11:39:42",
"11:39:43", "11:39:44", "11:39:45", "11:39:47", "11:39:48",
"11:39:49", "11:39:50", "11:39:52", "11:39:55", "11:39:59",
"11:40:01", "11:40:02", "11:40:04", "11:40:05", "11:40:06",
"11:40:07", "11:40:08", "11:40:15", "11:40:17", "11:40:18",
"11:40:19", "11:40:20", "11:40:21", "11:40:23", "11:40:24",
"11:40:25", "11:40:26", "11:40:28", "11:40:29", "11:40:30",
"11:40:31", "11:40:32", "11:40:33", "11:40:34", "11:40:35",
"11:40:37", "11:40:39", "11:40:41", "11:40:44", "11:40:45",
"11:40:48", "11:40:53", "11:41:09", "11:41:10", "11:41:12",
"11:41:13", "11:41:14", "11:43:01", "11:43:02", "11:43:03",
"11:43:12", "11:43:13", "11:43:14", "11:43:16", "11:43:17",
"11:43:18", "11:43:19", "11:43:20", "11:43:23", "11:43:25",
"11:43:27", "11:43:33", "11:43:39", "11:43:50", "11:43:51",
"11:43:52", "11:44:01", "11:44:03", "12:05:42", "12:05:44",
"12:05:46", "12:05:56", "12:05:58", "12:06:00", "12:06:01",
"12:06:02", "12:06:04", "12:06:07", "12:06:08", "12:06:10",
"12:06:13", "12:06:24", "12:06:25", "12:06:26", "12:06:28",
"12:06:29", "12:06:30", "12:06:32", "12:06:35", "12:06:38",
"12:06:39", "12:06:40", "12:06:42", "12:06:43", "12:06:44",
"12:06:45", "12:06:47", "12:06:53", "12:06:54", "12:06:55",
"12:06:56", "12:06:57", "12:07:06", "12:07:07", "12:07:08",
"12:07:10", "12:07:12", "12:07:14", "12:07:15", "12:07:18",
"12:07:20", "12:07:27", "12:07:29", "12:07:30", "12:07:31",
"12:07:33", "12:07:34", "12:07:35", "12:07:36", "12:07:38",
"12:07:39", "12:07:40", "12:07:42", "12:07:43", "12:07:44",
"12:07:46", "12:07:47", "12:07:48", "12:07:49", "12:07:50",
"12:07:51", "12:07:53", "12:07:54", "12:07:55", "12:07:56",
"12:07:57", "12:07:58", "12:07:59", "12:08:00", "12:08:01",
"12:08:02", "12:08:03", "12:08:05", "12:08:06", "12:08:07",
"12:08:08", "12:08:10", "12:08:11", "12:08:12", "12:08:13",
"12:08:14", "12:08:15", "12:08:16", "12:08:17", "12:08:18",
"12:08:19", "12:08:21", "12:08:22", "12:08:23", "12:08:24",
"12:08:25", "12:08:26", "12:08:27", "12:08:28", "12:08:29",
"12:08:30", "12:08:31", "12:08:33", "12:08:34", "12:08:35",
"12:08:36", "12:08:37", "12:08:38", "12:08:39", "12:08:40",
"12:08:41", "12:08:43", "12:08:44", "12:08:45", "12:08:46",
"12:08:47", "12:08:48", "12:08:49", "12:08:50", "12:08:51",
"12:08:52", "12:08:54", "12:08:55", "12:08:56", "12:08:57",
"12:08:58", "12:08:59", "12:09:00", "12:09:01", "12:09:02",
"12:09:03", "12:09:04", "12:09:05", "12:09:07", "12:09:08",
"12:09:09", "12:09:10", "12:09:11", "12:09:12", "12:09:13",
"12:09:14", "12:09:15", "12:09:16", "12:09:18", "12:09:19",
"12:09:20", "12:09:21", "12:09:22", "12:09:23", "12:09:24",
"12:09:27", "12:09:28", "12:09:29", "12:09:31", "12:09:32",
"12:09:40", "12:09:41", "12:09:42", "12:09:43", "12:09:44",
"12:09:45", "12:09:46", "12:09:47", "12:09:49", "12:10:04",
"12:10:05", "12:10:06", "12:10:07", "12:10:09", "12:10:10",
"12:10:14", "12:10:15", "12:10:16", "12:10:18", "12:10:19",
"12:10:20", "12:10:21", "12:10:22", "12:10:23", "12:10:24",
"12:10:25", "12:10:26", "12:10:28", "12:10:32", "12:10:35",
"12:10:37", "12:10:38", "12:10:39", "12:10:54", "12:11:09",
"12:11:10", "12:11:11", "12:11:12", "12:11:14", "12:11:15",
"12:11:18", "12:11:20", "12:11:21", "12:17:39", "12:17:40",
"12:17:42", "12:17:45", "12:17:50", "12:17:51", "12:17:52",
"12:17:53", "12:17:55", "12:17:56", "12:17:57", "12:17:59",
"12:18:00", "12:18:02", "12:18:09", "12:18:10", "12:18:14",
"12:18:15", "12:18:24", "12:18:38", "12:18:40", "12:18:41",
"20:39:39", "20:39:41", "20:48:52", "20:48:54", "20:48:55",
"20:49:01", "20:49:02", "20:49:03", "20:49:09"), class = "factor"),
csUriStem = c("/eacommon/systemconfigurationservice.svc/custombinding",
"/services/2015v1/engservice.svc/custombinding", "/eacommon/systemconfigurationservice.svc/custombinding",
"/eacommon/systemconfigurationservice.svc/custombinding",
"/services/2015v1/engservice.svc/custombinding", "/eaudit/services/sapv1/engservice.svc/custombinding"
), timeTaken = c(7421L, 8390L, 515L, 505L, 1385L, 1365L)), row.names = c(NA,
6L), class = "data.frame")
install.packages("sqldf")
library(sqldf)
#create subset of the original data
iislog1 <- iislog %>% select(iisdate,iistime,csUriStem,timeTaken)
#Find Count by Url and then Avg,Max,Min timeTaken for each Url
iislog6 <- sqldf(SELECT csUriStem AS iislog6$baseUrl FROM iislog1,
Count(*) as iislog6$totalRequests,
AVG(timeTaken) AS iislog6$avgRequestDuration,
MAX(timeTaken) AS iislog6$maxRequestDuration,
MIN(timeTaken) AS iislog6$minRequestDuration
GROUP BY iislog6$baseUrl
ORDER By iislog6$totalRequests DESC
)
I think this is what you were trying to do. I mainly used your SQL to translate it into R.
group_by is very powerfull in R and it is easy in use.
install.packages("dplyr")
library(dplyr)
iislog1 <- iislog %>% select(iisdate,iistime,csUriStem,timeTaken)
iislog6 <- group_by(iislog1, csUriStem) %>% summarise(totalRequests = n(),
avgRequestDuration = mean(timeTaken), maxRequestDuration = max(timeTaken),
minRequestDuration = min(timeTaken))
# order by
iislog6 <- arrange(iislog6, totalRequests)
There is something wrong with the dput output in the question so we used the data in the Note at the end.
The SQL syntax in the code in the question was incorrect -- it was a mix of SQL and R but the string must be pure SQL like this:
library(sqldf)
sqldf("SELECT
csUriStem AS baseUrl,
COUNT(*) AS totalRequests,
AVG(timeTaken) AS avgRequestDuration,
MAX(timeTaken) AS maxRequestDuration,
MIN(timeTaken) AS minRequestDuration
FROM iislog1
GROUP BY baseUrl
ORDER BY totalRequests DESC")
Note
This is the data used in reproducible form:
Lines <- "iisdate iistime csUriStem timeTaken
1 2019-05-17 03:05:39 /eACommon/SystemConfigurationService.svc/customBinding 7421
2 2019-05-17 03:07:22 /Services/2015V1/EngService.svc/customBinding 8390
3 2019-05-17 03:16:40 /eACommon/SystemConfigurationService.svc/customBinding 515
4 2019-05-17 03:17:39 /eACommon/SystemConfigurationService.svc/customBinding 505
5 2019-05-17 03:25:22 /Services/2015V1/EngService.svc/customBinding 1385
6 2019-05-17 03:31:16 /eAudIT/Services/SAPv1/EngService.svc/customBinding 1365"
iislog1 <- read.table(text = Lines, as.is = TRUE)

Linear Regression Analysis of population data with R

I have a homework assignment where I need to take a CSV file based around population data around the United States and do some data analysis on the data inside. I need to find the data that exists for my state and for starters run a Linear Regression Analysis to predict the size of the population.
I've been studying R for a few weeks now, went through a LinkedIn Learning training, as well as 2 different trainings on pluralsight about R. I have also tried searching for how to do a Linear Regression Analysis in R and I find plenty of examples for how to do it when the data is perfectly laid out in a table in just the right way to Analyze.
The CSV file is laid out so that each state is defined on a single line/row so I used the filter function to grab just the data for my State and put it into a variable.
Within that dataset the population data is defined across several columns with the most important data being the Population Estimates for each year from 2010 to 2018.
library(tidyverse)
population.data <- read_csv("nst-est2018-alldata.csv")
mn.state.data <- filter(population.data, NAME == "Minnesota")
I'm looking for some help to get headed in the right direction my thought is that I will need to create to containers of data 1 having each year from 2010 to 2018 and one that contains the population data for each of those years. And then use the xyplot function with those two containers? If you have some experience in this area please help me think this through I'm not looking for anybody to do the assignment for me just want some help trying to think it through.
Edit: Here is the results of the
dput(head(population.data))
command:
structure(list(SUMLEV = c("010", "020", "020", "020", "020",
"040"), REGION = c("0", "1", "2", "3", "4", "3"), DIVISION = c("0",
"0", "0", "0", "0", "6"), STATE = c("00", "00", "00", "00", "00",
"01"), NAME = c("United States", "Northeast Region", "Midwest Region",
"South Region", "West Region", "Alabama"), CENSUS2010POP = c(308745538L,
55317240L, 66927001L, 114555744L, 71945553L, 4779736L), ESTIMATESBASE2010
= c(308758105L,
55318430L, 66929743L, 114563045L, 71946887L, 4780138L), POPESTIMATE2010 =
c(309326085L,
55380645L, 66974749L, 114867066L, 72103625L, 4785448L), POPESTIMATE2011 =
c(311580009L,
55600532L, 67152631L, 116039399L, 72787447L, 4798834L), POPESTIMATE2012 =
c(313874218L,
55776729L, 67336937L, 117271075L, 73489477L, 4815564L), POPESTIMATE2013 =
c(316057727L,
55907823L, 67564135L, 118393244L, 74192525L, 4830460L), POPESTIMATE2014 =
c(318386421L,
56015864L, 67752238L, 119657737L, 74960582L, 4842481L), POPESTIMATE2015 =
c(320742673L,
56047587L, 67869139L, 121037542L, 75788405L, 4853160L), POPESTIMATE2016 =
c(323071342L,
56058789L, 67996917L, 122401186L, 76614450L, 4864745L), POPESTIMATE2017 =
c(325147121L,
56072676L, 68156035L, 123598424L, 77319986L, 4875120L), POPESTIMATE2018 =
c(327167434L,
56111079L, 68308744L, 124753948L, 77993663L, 4887871L), NPOPCHG_2010 =
c(567980L,
62215L, 45006L, 304021L, 156738L, 5310L), NPOPCHG_2011 = c(2253924L,
219887L, 177882L, 1172333L, 683822L, 13386L), NPOPCHG_2012 = c(2294209L,
176197L, 184306L, 1231676L, 702030L, 16730L), NPOPCHG_2013 = c(2183509L,
131094L, 227198L, 1122169L, 703048L, 14896L), NPOPCHG_2014 = c(2328694L,
108041L, 188103L, 1264493L, 768057L, 12021L), NPOPCHG_2015 = c(2356252L,
31723L, 116901L, 1379805L, 827823L, 10679L), NPOPCHG_2016 = c(2328669L,
11202L, 127778L, 1363644L, 826045L, 11585L), NPOPCHG_2017 = c(2075779L,
13887L, 159118L, 1197238L, 705536L, 10375L), NPOPCHG_2018 = c(2020313L,
38403L, 152709L, 1155524L, 673677L, 12751L), BIRTHS2010 = c(987836L,
163454L, 212614L, 368752L, 243016L, 14227L), BIRTHS2011 = c(3973485L,
646265L, 834909L, 1509597L, 982714L, 59689L), BIRTHS2012 = c(3936976L,
637904L, 830701L, 1504936L, 963435L, 59070L), BIRTHS2013 = c(3940576L,
635741L, 830869L, 1504799L, 969167L, 57936L), BIRTHS2014 = c(3963195L,
632433L, 836505L, 1525280L, 968977L, 58907L), BIRTHS2015 = c(3992376L,
634515L, 837968L, 1545722L, 974171L, 59637L), BIRTHS2016 = c(3962654L,
628039L, 831667L, 1541342L, 961606L, 59388L), BIRTHS2017 = c(3901982L,
616552L, 816177L, 1519944L, 949309L, 58259L), BIRTHS2018 = c(3855500L,
609336L, 804431L, 1499838L, 941895L, 57216L), DEATHS2010 = c(598691L,
110848L, 140785L, 228706L, 118352L, 11073L), DEATHS2011 = c(2512442L,
470816L, 586840L, 962751L, 492035L, 48818L), DEATHS2012 = c(2501531L,
460985L, 584817L, 960575L, 495154L, 48364L), DEATHS2013 = c(2608019L,
480032L, 605188L, 1011093L, 511706L, 50847L), DEATHS2014 = c(2582448L,
470196L, 597078L, 1006057L, 509117L, 49692L), DEATHS2015 = c(2699826L,
488881L, 626494L, 1052360L, 532091L, 51820L), DEATHS2016 = c(2703215L,
480331L, 619471L, 1058173L, 545240L, 51662L), DEATHS2017 = c(2779436L,
501022L, 620556L, 1092949L, 564909L, 53033L), DEATHS2018 = c(2814013L,
506909L, 621030L, 1109152L, 576922L, 53425L), NATURALINC2010 = c(389145L,
52606L, 71829L, 140046L, 124664L, 3154L), NATURALINC2011 = c(1461043L,
175449L, 248069L, 546846L, 490679L, 10871L), NATURALINC2012 = c(1435445L,
176919L, 245884L, 544361L, 468281L, 10706L), NATURALINC2013 = c(1332557L,
155709L, 225681L, 493706L, 457461L, 7089L), NATURALINC2014 = c(1380747L,
162237L, 239427L, 519223L, 459860L, 9215L), NATURALINC2015 = c(1292550L,
145634L, 211474L, 493362L, 442080L, 7817L), NATURALINC2016 = c(1259439L,
147708L, 212196L, 483169L, 416366L, 7726L), NATURALINC2017 = c(1122546L,
115530L, 195621L, 426995L, 384400L, 5226L), NATURALINC2018 = c(1041487L,
102427L, 183401L, 390686L, 364973L, 3791L), INTERNATIONALMIG2010 =
c(178835L,
45723L, 25158L, 68742L, 39212L, 928L), INTERNATIONALMIG2011 = c(792881L,
206686L, 116948L, 285343L, 183904L, 4716L), INTERNATIONALMIG2012 =
c(858764L,
207584L, 120995L, 344198L, 185987L, 5874L), INTERNATIONALMIG2013 =
c(850952L,
194103L, 126681L, 329897L, 200271L, 5111L), INTERNATIONALMIG2014 =
c(947947L,
222685L, 134310L, 365281L, 225671L, 3753L), INTERNATIONALMIG2015 =
c(1063702L,
227275L, 142759L, 429088L, 264580L, 4685L), INTERNATIONALMIG2016 =
c(1069230L,
236718L, 144859L, 436795L, 250858L, 5950L), INTERNATIONALMIG2017 =
c(953233L,
215872L, 126013L, 404582L, 206766L, 3190L), INTERNATIONALMIG2018 =
c(978826L,
229700L, 127583L, 418418L, 203125L, 3344L), DOMESTICMIG2010 = c(0L,
-32918L, -50873L, 90679L, -6888L, 1238L), DOMESTICMIG2011 = c(0L,
-159789L, -186896L, 335757L, 10928L, -2239L), DOMESTICMIG2012 = c(0L,
-205314L, -181285L, 336615L, 49984L, 59L), DOMESTICMIG2013 = c(0L,
-216273L, -123814L, 293443L, 46644L, 2641L), DOMESTICMIG2014 = c(0L,
-274391L, -182730L, 373439L, 83682L, -755L), DOMESTICMIG2015 = c(0L,
-339996L, -234823L, 452879L, 121940L, -1553L), DOMESTICMIG2016 = c(0L,
-372953L, -228200L, 442633L, 158520L, -1977L), DOMESTICMIG2017 = c(0L,
-316879L, -161387L, 364465L, 113801L, 2065L), DOMESTICMIG2018 = c(0L,
-292928L, -157048L, 345132L, 104844L, 5718L), NETMIG2010 = c(178835L,
12805L, -25715L, 159421L, 32324L, 2166L), NETMIG2011 = c(792881L,
46897L, -69948L, 621100L, 194832L, 2477L), NETMIG2012 = c(858764L,
2270L, -60290L, 680813L, 235971L, 5933L), NETMIG2013 = c(850952L,
-22170L, 2867L, 623340L, 246915L, 7752L), NETMIG2014 = c(947947L,
-51706L, -48420L, 738720L, 309353L, 2998L), NETMIG2015 = c(1063702L,
-112721L, -92064L, 881967L, 386520L, 3132L), NETMIG2016 = c(1069230L,
-136235L, -83341L, 879428L, 409378L, 3973L), NETMIG2017 = c(953233L,
-101007L, -35374L, 769047L, 320567L, 5255L), NETMIG2018 = c(978826L,
-63228L, -29465L, 763550L, 307969L, 9062L), RESIDUAL2010 = c(0L,
-3196L, -1108L, 4554L, -250L, -10L), RESIDUAL2011 = c(0L, -2459L,
-239L, 4387L, -1689L, 38L), RESIDUAL2012 = c(0L, -2992L, -1288L,
6502L, -2222L, 91L), RESIDUAL2013 = c(0L, -2445L, -1350L, 5123L,
-1328L, 55L), RESIDUAL2014 = c(0L, -2490L, -2904L, 6550L, -1156L,
-192L), RESIDUAL2015 = c(0L, -1190L, -2509L, 4476L, -777L, -270L
), RESIDUAL2016 = c(0L, -271L, -1077L, 1047L, 301L, -114L), RESIDUAL2017 =
c(0L,
-636L, -1129L, 1196L, 569L, -106L), RESIDUAL2018 = c(0L, -796L,
-1227L, 1288L, 735L, -102L), RBIRTH2011 = c(12.79898857, 11.646389369,
12.449493906, 13.0753983, 13.564866164, 12.455601786), RBIRTH2012 =
c(12.589173852,
11.454833676, 12.353389372, 12.900715293, 13.172754439, 12.287820829
), RBIRTH2013 = c(12.511116578, 11.384582534, 12.318197145, 12.770698648,
13.1250523, 12.012410502), RBIRTH2014 = c(12.493440163, 11.301146646,
12.363692308, 12.814734, 12.993051496, 12.179749675), RBIRTH2015 =
c(12.493175596,
11.324209532, 12.357461907, 12.843808208, 12.92441189, 12.301816868
), RBIRTH2016 = c(12.309933949, 11.20434042, 12.242454436, 12.663079639,
12.619264908, 12.222387438), RBIRTH2017 = c(12.039095529, 10.996948983,
11.989119413, 12.357287884, 12.333939366, 11.962999487), RBIRTH2018 =
c(11.820984126,
10.863177115, 11.789576855, 12.078306222, 12.128940451, 11.720998206
), RDEATH2011 = c(8.0928244199, 8.4846099623, 8.7504877826, 8.3388830191,
6.7917918366, 10.187095914), RDEATH2012 = c(7.9990857588, 8.2779015368,
8.6968381072, 8.2343067033, 6.7700904074, 10.060744313), RDEATH2013 =
c(8.2803198685,
8.5962112289, 8.9723230665, 8.5807898649, 6.9298356343, 10.542582104
), RDEATH2014 = c(8.1408206164, 8.4020820365, 8.8249187702, 8.4524499397,
6.8267702932, 10.274434632), RDEATH2015 = c(8.4484528254, 8.7250748685,
9.2388679994, 8.7443343664, 7.0592978512, 10.689339673), RDEATH2016 =
c(8.3975028099,
8.5692003816, 9.1188486402, 8.6935469035, 7.1552465339, 10.632332792
), RDEATH2017 = c(8.5756150392, 8.9363320099, 9.1155717285, 8.8857783149,
7.3396052849, 10.889883997), RDEATH2018 = c(8.6277792774, 9.0371195009,
9.1016891619, 8.9320830002, 7.4291216994, 10.944391939), RNATURALINC2011 =
c(4.7061641498,
3.161779407, 3.6990061239, 4.7365152812, 6.7730743272, 2.2685058724
), RNATURALINC2012 = c(4.5900880929, 3.1769321388, 3.656551265,
4.66640859, 6.402664032, 2.2270765159), RNATURALINC2013 = c(4.2307967093,
2.7883713049, 3.3458740787, 4.1899087829, 6.1952166656, 1.4698283977
), RNATURALINC2014 = c(4.3526195469, 2.89906461, 3.5387735378,
4.3622840605, 6.1662812026, 1.9053150433), RNATURALINC2015 =
c(4.0447227708,
2.5991346635, 3.1185939072, 4.0994738414, 5.8651140389, 1.6124771946
), RNATURALINC2016 = c(3.912431139, 2.6351400388, 3.123605796,
3.969532736, 5.4640183742, 1.5900546466), RNATURALINC2017 =
c(3.4634804902,
2.0606169731, 2.8735476848, 3.4715095687, 4.9943340813, 1.0731154898
), RNATURALINC2018 = c(3.1932048488, 1.8260576141, 2.687887693,
3.1462232219, 4.6998187519, 0.7766062675), RINTERNATIONALMIG2011 =
c(2.5539481982,
3.7247036946, 1.7438348531, 2.4715029092, 2.5385138982, 0.9841112772
), RINTERNATIONALMIG2012 = c(2.7460490726, 3.7275831375, 1.7993217139,
2.9505576333, 2.5429438207, 1.2219173785), RINTERNATIONALMIG2013 =
c(2.7017267715,
3.4759149144, 1.8781318506, 2.7997195452, 2.7121923767, 1.0597112344
), RINTERNATIONALMIG2014 = c(2.988275652, 3.9792291689, 1.9851256285,
3.0689308523, 3.0260314993, 0.7759790947), RINTERNATIONALMIG2015 =
c(3.3285982753,
4.0561842059, 2.1052580818, 3.5654043717, 3.5102060089, 0.9664136698
), RINTERNATIONALMIG2016 = c(3.3215493142, 4.2230961065, 2.1323795548,
3.5885415898, 3.2920380658, 1.2245437674), RINTERNATIONALMIG2017 =
c(2.9410856198,
3.8503376372, 1.8510505744, 3.2892897676, 2.6864164429, 0.6550398799
), RINTERNATIONALMIG2018 = c(3.0010858795, 4.0950670621, 1.8698304564,
3.3695510667, 2.6156748143, 0.685035969), RDOMESTICMIG2011 = c(0,
-2.879569389, -2.786843372, 2.9081645678, 0.1508443529, -0.467223314
), RDOMESTICMIG2012 = c(0, -3.686820778, -2.69589683, 2.8855541222,
0.6834160664, 0.0122732593), RDOMESTICMIG2013 = c(0, -3.872925953,
-1.835626629, 2.4903472978, 0.6316815776, 0.5475831286), RDOMESTICMIG2014
= c(0,
-4.903180146, -2.700781819, 3.1374707924, 1.1220952977, -0.156105573
), RDOMESTICMIG2015 = c(0, -6.067919504, -3.462920156, 3.7630900106,
1.6177886489, -0.320350145), RDOMESTICMIG2016 = c(0, -6.653555548,
-3.359190761, 3.6365043774, 2.0802759896, -0.40687782), RDOMESTICMIG2017 =
c(0,
-5.651919379, -2.370672066, 2.963134779, 1.4785645494, 0.4240305179
), RDOMESTICMIG2018 = c(0, -5.222289092, -2.301663494, 2.7793734944,
1.350093835, 1.1713623417), RNETMIG2011 = c(2.5539481982, 0.845134306,
-1.043008519, 5.379667477, 2.6893582511, 0.516887963), RNETMIG2012 =
c(2.7460490726,
0.0407623599, -0.896575116, 5.8361117555, 3.2263598871, 1.2341906378
), RNETMIG2013 = c(2.7017267715, -0.397011039, 0.0425052219,
5.2900668429, 3.3438739543, 1.6072943629), RNETMIG2014 = c(2.988275652,
-0.923950977, -0.71565619, 6.2064016447, 4.148126797, 0.6198735214
), RNETMIG2015 = c(3.3285982753, -2.011735298, -1.357662074,
7.3284943823, 5.1279946578, 0.6460635248), RNETMIG2016 = c(3.3215493142,
-2.430459441, -1.226811206, 7.2250459672, 5.3723140554, 0.8176659475
), RNETMIG2017 = c(2.9410856198, -1.801581742, -0.519621492,
6.2524245465, 4.1649809923, 1.0790703978), RNETMIG2018 = c(3.0010858795,
-1.12722203, -0.431833037, 6.1489245611, 3.9657686492, 1.8563983107
)), .Names = c("SUMLEV", "REGION", "DIVISION", "STATE", "NAME",
"CENSUS2010POP", "ESTIMATESBASE2010", "POPESTIMATE2010",
"POPESTIMATE2011",
"POPESTIMATE2012", "POPESTIMATE2013", "POPESTIMATE2014",
"POPESTIMATE2015",
"POPESTIMATE2016", "POPESTIMATE2017", "POPESTIMATE2018", "NPOPCHG_2010",
"NPOPCHG_2011", "NPOPCHG_2012", "NPOPCHG_2013", "NPOPCHG_2014",
"NPOPCHG_2015", "NPOPCHG_2016", "NPOPCHG_2017", "NPOPCHG_2018",
"BIRTHS2010", "BIRTHS2011", "BIRTHS2012", "BIRTHS2013", "BIRTHS2014",
"BIRTHS2015", "BIRTHS2016", "BIRTHS2017", "BIRTHS2018", "DEATHS2010",
"DEATHS2011", "DEATHS2012", "DEATHS2013", "DEATHS2014", "DEATHS2015",
"DEATHS2016", "DEATHS2017", "DEATHS2018", "NATURALINC2010",
"NATURALINC2011",
"NATURALINC2012", "NATURALINC2013", "NATURALINC2014", "NATURALINC2015",
"NATURALINC2016", "NATURALINC2017", "NATURALINC2018",
"INTERNATIONALMIG2010",
"INTERNATIONALMIG2011", "INTERNATIONALMIG2012", "INTERNATIONALMIG2013",
"INTERNATIONALMIG2014", "INTERNATIONALMIG2015", "INTERNATIONALMIG2016",
"INTERNATIONALMIG2017", "INTERNATIONALMIG2018", "DOMESTICMIG2010",
"DOMESTICMIG2011", "DOMESTICMIG2012", "DOMESTICMIG2013",
"DOMESTICMIG2014",
"DOMESTICMIG2015", "DOMESTICMIG2016", "DOMESTICMIG2017",
"DOMESTICMIG2018",
"NETMIG2010", "NETMIG2011", "NETMIG2012", "NETMIG2013", "NETMIG2014",
"NETMIG2015", "NETMIG2016", "NETMIG2017", "NETMIG2018", "RESIDUAL2010",
"RESIDUAL2011", "RESIDUAL2012", "RESIDUAL2013", "RESIDUAL2014",
"RESIDUAL2015", "RESIDUAL2016", "RESIDUAL2017", "RESIDUAL2018",
"RBIRTH2011", "RBIRTH2012", "RBIRTH2013", "RBIRTH2014", "RBIRTH2015",
"RBIRTH2016", "RBIRTH2017", "RBIRTH2018", "RDEATH2011", "RDEATH2012",
"RDEATH2013", "RDEATH2014", "RDEATH2015", "RDEATH2016", "RDEATH2017",
"RDEATH2018", "RNATURALINC2011", "RNATURALINC2012", "RNATURALINC2013",
"RNATURALINC2014", "RNATURALINC2015", "RNATURALINC2016",
"RNATURALINC2017",
"RNATURALINC2018", "RINTERNATIONALMIG2011", "RINTERNATIONALMIG2012",
"RINTERNATIONALMIG2013", "RINTERNATIONALMIG2014", "RINTERNATIONALMIG2015",
"RINTERNATIONALMIG2016", "RINTERNATIONALMIG2017", "RINTERNATIONALMIG2018",
"RDOMESTICMIG2011", "RDOMESTICMIG2012", "RDOMESTICMIG2013",
"RDOMESTICMIG2014",
"RDOMESTICMIG2015", "RDOMESTICMIG2016", "RDOMESTICMIG2017",
"RDOMESTICMIG2018",
"RNETMIG2011", "RNETMIG2012", "RNETMIG2013", "RNETMIG2014", "RNETMIG2015",
"RNETMIG2016", "RNETMIG2017", "RNETMIG2018"), row.names = c(NA,
-6L), class = c("tbl_df", "tbl", "data.frame"))
In order to help you out, an example data using dput(head(population.data)) would be helpful. Based on your comments, your data is in what is called 'wide' format, meaning each observation is contained in a column, rather than a row (pupulation 2010, population 2011 etc.).
As i hinted in my comment, a sub-goal within statistical modelling is always to clean and reshape data to a proper format, that will work for running models. In this case the problem is that your format is in an incorrect shape. The most common is likely melting to long format via the reshape2 or data.table package as explained in this link. I personally prefer the data.table package, as it seems to have better large scale performance. Their usage however is identical.
Lets say you have a column 'NAME' for states and 9 columns for population estimates (2010 population estimates, 2011 population estimates and so on), we could then convert these columns into a long format, using melt from either of the two suggested packages (They are identical in use)
require(data.table)
value_columns <- paste(2010:2018, "Population Estimates")
population.data_long <- melt(population.data, id.vars = "NAME",
measure.vars = value_columns, #Columns containing values we (that are grouped by their column names)
variable.name = 'Year (Population Estimate)', #Name of the column which tells us [(Year) Population Estimate]
value.name = 'Population Estimate') #Name of the column with values
population.data_long$year <- as.integer(substr(population.data_long$`Year (Population Estimate)`, 1, 4)) #Create a year column in a bit of a hacky way
Note i have ignored any additional columns, and these should be included in your melt statement. From here on a linear regression should follow any standard example that you have found.

How to plot the forecasted values against actual values observed later in R?

We used the R library forecast to make predictions for the next 24 hours. We have the following:
fore_cast=forecast.tbats(model,h=24,level=90)
fore_cast
Point Forecast Lo 90 Hi 90
5.380952 6270.778 5389.089 7296.643
5.386905 5458.096 4557.375 6536.743
5.392857 5219.995 4248.967 6412.814
5.398810 5187.102 4126.390 6520.328
Now we have 2 problems:
We need 'time' (in hour e.g. 01,23,19 etc) instead of 'point'.
We wish to plot the trendline against time showing the actual observed
values against these predicted values. We have loaded actual observed
values from a CSV file.
We tried:
actual_data = read.csv('actualdata.csv')
plot(actual_data,fore_cast)
Doesn't work, and using plot(actual_data) just shows some points in a straight line instead of curved trendline.
EDIT:
Sample output of fore_cast from dput:
structure(list(model = structure(list(lambda = 0.000438881055939422,
alpha = 0.65694875480321, beta = -0.0983972877836753, damping.parameter = 0.800419363290521,
gamma.one.values = c(-0.00150031474145603, -0.00124696854910294
), gamma.two.values = c(0.0023600487982342, -0.002465549595849
), ar.coefficients = NULL, ma.coefficients = NULL, likelihood = 13202.294346586,
optim.return.code = 0L, variance = 0.00855092137349485, AIC = 13258.294346586,
parameters = structure(list(vect = c(0.000438881055939422,
0.65694875480321, 0.800419363290521, -0.0983972877836753,
-0.00150031474145603, -0.00124696854910294, 0.0023600487982342,
-0.002465549595849), control = structure(list(use.beta = TRUE,
use.box.cox = TRUE, use.damping = TRUE, length.gamma = 4L,
p = 0, q = 0), .Names = c("use.beta", "use.box.cox",
"use.damping", "length.gamma", "p", "q"))), .Names = c("vect",
"control")), seed.states = structure(c(7.44188559667267,
0.00357069100887873, -0.0664300680553579, 0.0229067500159256,
0.00460111570469819, -0.00772324725408007, -0.000610110386029883,
0.00568378752162509, -0.0084050648066819, -0.0324093004247092,
-0.000720936399990958, -0.00705790547321605, -0.00738992950838566,
0.00180424326179638, -0.00107745502434416, 0.00242014705705761,
-0.01824679745657, 0.0123019701003545, -0.0245935735677402,
0.0181321397860132), .Dim = c(20L, 1L)), fitted.values = structure(c(1598.57443298879,
1435.74973092922, 1397.92464316794, 1296.90202189518, 1440.3201303663,
1544.11695101118, 1777.97079874181, 1766.50571671645, 1925.27360388028,
1863.26963233038, 1773.08363764691, 1887.26580055295, 1887.48006609474,
1841.66200850472, 1991.90290660363, 2233.04775631848, 2081.30246965768,
1872.12639817609, 1899.38583561568, 2213.43437455052, 2214.00832820531,
1745.36311914995, 1678.67975050944, 1502.35472259274, 1512.27350460399,
1456.14165844166, 1464.3803467642, 1517.99443293857, 1484.54280422369,
1382.37041287489, 1452.43700910726, 1545.16934543365, 1440.50974319508,
1475.59742668699, 1544.88546424501, 1790.95280713647, 1916.4267023671,
1928.72804180587, 1819.15839770808, 1916.43079357329, 1836.80043977753,
1720.25638746452, 1730.03629161412, 1614.6048115754, 1599.23641723244,
1635.86950932066, 1543.46360784778, 1641.35066985679, 1608.60556151299,
1651.47649465456, 1475.15006990464, 1403.67294742438, 1507.58932406857,
1666.3170708439, 1696.06132797576, 1543.32187293056, 1704.58043626911,
1914.72424191575, 2109.33624862625, 2092.98934458578, 2222.13355258602,
2084.68677709368, 1962.9230489947, 2045.61547393981, 2140.30565941261,
2097.46130996426, 2126.07936955385, 2226.18935508502, 2269.54492801286,
2300.37314952852, 2398.48786829541, 2303.31270702723, 2332.74139979969,
2146.51487558643, 2101.27480789243, 2111.61910899422, 2053.57840714969,
2046.56606362537, 2073.82870990658, 2094.88831798868, 2334.85185938782,
2541.72156227893, 2502.36031483721, 2398.12240784327, 2266.35832277135,
2151.05248890962, 2266.88803633019, 2366.19453856405, 2399.97570044332,
2341.74959623409, 2144.33465155869, 2102.91952061083, 2214.48622101851,
2179.48115699957, 2288.28092735955, 2224.55218736155, 2195.1506809087,
2163.94619334319, 2161.41843642149, 2134.75060670667, 2138.77895768654,
2142.84680080931, 2258.55072549978, 2297.90237035988, 2314.94197015208,
2300.99928929609, 2277.39754662665, 2291.06980363364, 2487.04257346235,
2381.05768214413, 2509.40078456481, 2657.61336243367, 2528.65026804303,
2434.2722174014, 2366.04811963942, 2270.6647135766, 2231.33965004538,
2376.51043520344, 2249.42861599343, 2193.98771109322, 2252.12327312365,
2210.76969838623, 2180.50451255189, 2221.92898123682, 2537.84678083006,
2329.57350097532, 2252.82349908982, 2143.92033677754, 2092.3142840022,
2084.70304624685, 2111.18929138546, 2160.05383108999, 2280.94409931504,
2118.22029344747, 2214.65738250204, 2269.05911898631, 2084.26658709038,
2016.04764576402, 2095.57091797435, 2161.07354463394, 2427.77607700887,
2333.91103594967, 2234.23838054763, 2250.71557301013, 2186.97925802073,
2129.51096829218, 2115.40228652934, 2094.89231085691, 2086.41044567131,
2180.94542608489, 2105.38187642016, 2459.45788915933, 2292.36325639374,
2410.75372754831, 2375.56640249604, 2491.11938114866, 2470.51372278037,
2464.95765202085, 2600.85929020727, 2709.48518695182, 2779.77558137814,
2518.29927341458, 2344.06621605191, 2391.56719713269, 2368.68842788795,
2199.93530349068, 2113.92970206565, 2458.96718445444, 3121.97852988865,
2559.40932439262, 2331.12829078836, 2238.54586985577, 2241.91440620202,
2225.29804576634, 2154.14147781021, 2060.57980596908, 2037.30100544426,
2215.93410789353, 2364.42668160056, 2518.72871618042, 2537.34279365294,
2473.76096855791, 2623.63387707374, 2589.08335304697, 2577.0563838788,
2349.53279218826, 2305.52193868551, 2232.63712180453, 2167.50003597208,
2320.23187534213, 2281.86365949586, 2281.21119271599, 2323.2014703372,
2185.94404743238, 2140.21863271207, 2011.67723856012, 1966.52063119589,
2002.67344212857, 1952.41101080662, 1988.37461163105, 2126.75137749373,
2239.14722292367, 2320.98046489603, 2444.91847853015, 2431.69548763034,
2514.73820659393, 2505.85249387343, 2888.19773974179, 2853.20690693738,
2502.20865871069, 2524.56894781003, 2659.52271740553, 2615.9025930681,
2923.69327019152, 2754.76074569658, 2784.59488335761, 2874.24378479002,
2683.41908597168, 2733.83011888159, 2774.1325162997, 2906.41593326865,
2726.06821502751, 2460.21579967528, 2450.8035097605, 2547.39389733175,
2625.60323572861, 2827.94083526683, 2971.92012845614, 3042.90981987278,
2835.00811374845, 2846.98066660519, 2871.21876763166, 2901.99696373824,
2627.47532996657, 2583.75084300313, 2602.68041642846, 2632.8054092953,
2667.85374690972, 2639.10586730146, 2466.95799545022, 2381.06823502402,
2531.32611053776, 2407.14812148706, 2342.75701798463, 2401.73791085847,
2365.50645844524, 2404.50408575777, 2452.57343738519, 2613.15332739214,
2665.50965844576, 2723.8237337447, 2915.09266385617, 2890.17498445896,
2853.6278331055, 2868.1228183545, 2917.07803535669, 2876.59409770233,
2577.82035337979, 2581.91435020803, 2520.20342021937, 2603.37973251208,
2536.03988578365, 2510.83398648802, 2472.80606784857, 2425.51212342113,
2442.02863541673, 2465.73405821711, 2384.42988766816, 2555.51500549788,
2737.77091706275, 2425.00224845814, 2460.17325671183, 2639.16650619329,
2816.37024420397, 2755.69999167982, 2802.64991688288, 2685.12803367301,
2521.77568128564, 2500.99980614696, 2620.41659854805, 2529.25134423133,
2590.14804885984, 2318.80485234464, 2341.88940012276, 2460.21008281205,
2513.70688167177, 2437.71670675479, 2383.29782281743, 2499.36244454453,
2472.98602901478, 2491.10649022417, 2350.1405559119, 2362.78308814045,
2431.3911847573, 2321.15216823049, 2355.74203614213, 2429.60523843166,
2355.61947983433, 2346.3751018515, 2453.82214513707, 2542.98125962684,
2342.43364707529, 2302.17741211575, 2388.93541944219, 2435.41878657221, ....
Sample output from dput for actual observed values:
structure(list(index12 = c(6297.416944, 5406.865556, 4718.355556,
5304.729167, 4968.014722, 5081.130833, 5544.955, 4655.009444,
4269.023056, 4346.588333, 4511.455833, 5102.57, 4818.673333,
4862.343056, 4785.176667, 5385.005278, 6469.080833, 7166.025278,
7010.708333, 511.114167)), .Names = "index12", class = "data.frame", row.names = c(NA,
-20L))
The value of Point is unusual in spite of hour unit data. I think you failed to make a model.
Here is my example:
actual_data <- structure(list(index12 = c(6297.416944, 5406.865556, 4718.355556,
5304.729167, 4968.014722, 5081.130833, 5544.955, 4655.009444,
4269.023056, 4346.588333, 4511.455833, 5102.57, 4818.673333,
4862.343056, 4785.176667, 5385.005278, 6469.080833, 7166.025278,
7010.708333, 511.114167)),
.Names = "index12", class = "data.frame", row.names = c(NA, -20L))
# I suppose that actual_data was taken per hour.
num_actual <- as.numeric(actual_data[,1])
model <- bats(num_actual)
fore_cast <- forecast(model, h=24, level=90)
fore_cast # Point is from 21 to 44 because of length(actual_data)=20 and demanding predictions for the next 24 hours
# Point Forecast Lo 90 Hi 90
# 21 5063.207 2902.187 7224.226
# 22 5108.114 2946.988 7269.241
# :
# 44 5108.114 2944.629 7271.600
# plot() has forecast method. It draws actual_data and prediction, and paints Lo90-Hi90.
plot(fore_cast, main="")

trouble adding geom_vline to ggplot2

I have a large time series data set, which I've used xts to summarize in 30 second periods. Not sure how to make this set easily reproducible but it looks like this
> str(taonedf)
'data.frame': 480 obs. of 2 variables:
$ time : POSIXct, format: "2013-01-06 13:00:29" "2013-01-06 13:00:59" "2013-01-06 13:01:29" ...
$ count: int 20763 12030 22188 12183 21112 11628 21543 12609 20095 12992 ...
> head(taonedf)
time count
1 2013-01-06 13:00:29 20763
2 2013-01-06 13:00:59 12030
3 2013-01-06 13:01:29 22188
4 2013-01-06 13:01:59 12183
5 2013-01-06 13:02:29 21112
6 2013-01-06 13:02:59 11628
I've plotted a normal line plot of this and it works fine.
ggplot(data=taonedf, aes(x=time, y=count/30)) + #
geom_line(color="#009E73") +
scale_y_continuous(name="requests per second", labels = format_format(scientific=FALSE, big.mark=",")) +
scale_x_datetime(name="",labels = date_format("%b %d\n%H:%M") ) +
labs(title=paste("Requests per Second - All Requests",count,sep="\n")) +
theme(legend.position = "none")
I want to add some vline annotations. I've created a second dataframe called EV, it looks like this:
> str(ev)
'data.frame': 10 obs. of 2 variables:
$ dt : POSIXct, format: "2013-01-06 13:45:00" "2013-01-06 14:18:00" "2013-01-06 14:49:00" ...
$ event: Factor w/ 9 levels "Event 1",..: 7 8 3 2 5 6 1 4 2 9
> head(ev)
dt event
1 2013-01-06 13:45:00 Event 1
Now, when I add the vline option I get odd results. I'm using the same date time format between the two so the scale should align.
ggplot(data=taonedf, aes(x=time, y=count/30)) +
geom_line(color="#009E73") +
geom_vline(data=ev,aes(xtintercept=dt))+
scale_y_continuous(name="requests per second", labels = format_format(scientific=FALSE, big.mark=",")) +
scale_x_datetime(name="",labels = date_format("%b %d\n%H:%M") ) +
labs(title=paste("Requests per Second - All Requests",count,sep="\n")) +
theme(legend.position = "none")
What am I missing? This doesn't appear to be that hard. All of the documentation and examples show simple numeric X axis so I'm assuming there is some issue with dates in the X axis but I can't pinpoint it. Any help would be appreciated.
> dput(taonedf)
structure(list(time = structure(c(1357506029.996, 1357506059.999,
1357506089.997, 1357506119.998, 1357506149.998, 1357506179.996,
1357506209.996, 1357506239.993, 1357506269.999, 1357506299.996,
1357506329.998, 1357506359.998, 1357506389.999, 1357506419.998,
1357506449.986, 1357506479.996, 1357506509.99, 1357506539.988,
1357506569.996, 1357506599.999, 1357506629.991, 1357506659.998,
1357506689.999, 1357506719.995, 1357506749.996, 1357506779.998,
1357506809.998, 1357506839.997, 1357506869.996, 1357506899.996,
1357506929.997, 1357506959.994, 1357506989.998, 1357507019.999,
1357507049.999, 1357507079.998, 1357507109.998, 1357507139.999,
1357507169.998, 1357507199.99, 1357507229.999, 1357507259.999,
1357507289.999, 1357507319.998, 1357507349.997, 1357507379.997,
1357507409.999, 1357507439.998, 1357507469.994, 1357507499.996,
1357507529.996, 1357507559.996, 1357507589.995, 1357507619.988,
1357507649.999, 1357507679.994, 1357507709.996, 1357507739.996,
1357507769.994, 1357507799.991, 1357507829.999, 1357507859.999,
1357507889.999, 1357507919.999, 1357507949.999, 1357507979.999,
1357508009.999, 1357508039.999, 1357508069.998, 1357508099.999,
1357508129.999, 1357508159.999, 1357508189.999, 1357508219.998,
1357508249.999, 1357508279.999, 1357508309.999, 1357508339.999,
1357508369.999, 1357508399.999, 1357508429.998, 1357508459.999,
1357508489.999, 1357508519.999, 1357508549.999, 1357508579.999,
1357508609.999, 1357508639.999, 1357508669.999, 1357508699.999,
1357508729.999, 1357508759.998, 1357508789.999, 1357508819.998,
1357508849.999, 1357508879.998, 1357508909.999, 1357508939.996,
1357508969.999, 1357508999.999, 1357509029.999, 1357509059.999,
1357509089.999, 1357509119.999, 1357509149.999, 1357509179.999,
1357509209.999, 1357509239.999, 1357509269.999, 1357509299.999,
1357509329.999, 1357509359.999, 1357509389.999, 1357509419.999,
1357509449.999, 1357509479.999, 1357509509.999, 1357509539.999,
1357509569.976, 1357509599.999, 1357509629.999, 1357509659.999,
1357509689.999, 1357509719.999, 1357509749.996, 1357509779.999,
1357509809.999, 1357509839.999, 1357509869.999, 1357509899.999,
1357509929.999, 1357509959.996, 1357509989.999, 1357510019.997,
1357510049.998, 1357510079.997, 1357510109.999, 1357510139.999,
1357510169.999, 1357510199.999, 1357510229.999, 1357510259.999,
1357510289.999, 1357510319.999, 1357510349.999, 1357510379.999,
1357510409.999, 1357510439.999, 1357510469.999, 1357510499.999,
1357510529.999, 1357510559.999, 1357510589.999, 1357510619.999,
1357510649.999, 1357510679.999, 1357510709.999, 1357510739.983,
1357510769.999, 1357510799.999, 1357510829.999, 1357510859.999,
1357510889.999, 1357510919.999, 1357510949.999, 1357510979.999,
1357511009.997, 1357511039.999, 1357511069.999, 1357511099.999,
1357511129.999, 1357511159.999, 1357511189.999, 1357511219.999,
1357511249.999, 1357511279.999, 1357511309.999, 1357511339.999,
1357511369.999, 1357511399.999, 1357511429.999, 1357511459.999,
1357511489.999, 1357511519.999, 1357511549.999, 1357511579.999,
1357511609.999, 1357511639.999, 1357511669.999, 1357511699.999,
1357511729.999, 1357511759.999, 1357511789.996, 1357511819.999,
1357511849.999, 1357511879.999, 1357511909.999, 1357511939.993,
1357511969.999, 1357511999.998, 1357512029.999, 1357512059.999,
1357512089.999, 1357512119.999, 1357512149.999, 1357512179.998,
1357512209.999, 1357512239.999, 1357512269.999, 1357512299.999,
1357512329.997, 1357512359.993, 1357512389.997, 1357512419.999,
1357512449.999, 1357512479.998, 1357512509.999, 1357512539.999,
1357512569.999, 1357512599.999, 1357512629.999, 1357512659.995,
1357512689.999, 1357512719.999, 1357512749.999, 1357512779.995,
1357512809.999, 1357512839.999, 1357512869.999, 1357512899.999,
1357512929.999, 1357512959.999, 1357512989.997, 1357513019.996,
1357513049.999, 1357513079.999, 1357513109.999, 1357513139.999,
1357513169.999, 1357513199.993, 1357513229.999, 1357513259.999,
1357513289.999, 1357513319.999, 1357513349.998, 1357513379.999,
1357513409.999, 1357513439.999, 1357513469.999, 1357513499.999,
1357513529.999, 1357513559.999, 1357513589.999, 1357513619.999,
1357513649.999, 1357513679.999, 1357513709.999, 1357513739.999,
1357513769.999, 1357513799.998, 1357513829.997, 1357513859.999,
1357513889.999, 1357513919.999, 1357513949.999, 1357513979.998,
1357514009.999, 1357514039.996, 1357514069.999, 1357514099.999,
1357514129.999, 1357514159.999, 1357514189.999, 1357514219.999,
1357514249.999, 1357514279.999, 1357514309.999, 1357514339.993,
1357514369.999, 1357514399.999, 1357514429.999, 1357514459.999,
1357514489.999, 1357514519.999, 1357514549.988, 1357514579.997,
1357514609.999, 1357514639.998, 1357514669.984, 1357514699.999,
1357514729.999, 1357514759.999, 1357514789.999, 1357514819.999,
1357514849.999, 1357514879.999, 1357514909.999, 1357514939.996,
1357514969.999, 1357514999.999, 1357515029.999, 1357515059.998,
1357515089.999, 1357515119.97, 1357515149.998, 1357515179.999,
1357515209.999, 1357515239.999, 1357515269.999, 1357515299.999,
1357515329.999, 1357515359.999, 1357515389.999, 1357515419.999,
1357515449.999, 1357515479.999, 1357515509.999, 1357515539.999,
1357515569.999, 1357515599.999, 1357515629.995, 1357515659.999,
1357515689.999, 1357515719.999, 1357515749.999, 1357515779.999,
1357515809.995, 1357515839.999, 1357515869.999, 1357515899.999,
1357515929.999, 1357515959.999, 1357515989.999, 1357516019.999,
1357516049.999, 1357516079.999, 1357516109.999, 1357516139.999,
1357516169.999, 1357516199.999, 1357516229.999, 1357516259.998,
1357516289.998, 1357516319.999, 1357516349.999, 1357516379.999,
1357516409.999, 1357516439.999, 1357516469.999, 1357516499.999,
1357516529.999, 1357516559.999, 1357516589.999, 1357516619.999,
1357516649.999, 1357516679.999, 1357516709.999, 1357516739.999,
1357516769.999, 1357516799.999, 1357516829.999, 1357516859.999,
1357516889.999, 1357516919.999, 1357516949.999, 1357516979.999,
1357517009.999, 1357517039.999, 1357517069.999, 1357517099.999,
1357517129.999, 1357517159.998, 1357517189.999, 1357517219.999,
1357517249.999, 1357517279.999, 1357517309.999, 1357517339.999,
1357517369.999, 1357517399.998, 1357517429.999, 1357517459.999,
1357517489.999, 1357517519.999, 1357517549.999, 1357517579.999,
1357517609.999, 1357517639.999, 1357517669.999, 1357517699.999,
1357517729.999, 1357517759.999, 1357517789.999, 1357517819.999,
1357517849.999, 1357517879.999, 1357517909.999, 1357517939.999,
1357517969.999, 1357517999.999, 1357518029.999, 1357518059.976,
1357518089.999, 1357518119.998, 1357518149.998, 1357518179.999,
1357518209.987, 1357518239.999, 1357518269.998, 1357518299.991,
1357518329.998, 1357518359.999, 1357518389.994, 1357518419.994,
1357518449.995, 1357518479.999, 1357518509.999, 1357518539.998,
1357518569.983, 1357518599.999, 1357518629.998, 1357518659.994,
1357518689.999, 1357518719.988, 1357518749.999, 1357518779.999,
1357518809.999, 1357518839.999, 1357518869.999, 1357518899.999,
1357518929.999, 1357518959.999, 1357518989.999, 1357519019.999,
1357519049.999, 1357519079.998, 1357519109.999, 1357519139.999,
1357519169.999, 1357519199.999, 1357519229.999, 1357519259.999,
1357519289.999, 1357519319.999, 1357519349.999, 1357519379.999,
1357519409.999, 1357519439.999, 1357519469.999, 1357519499.999,
1357519529.999, 1357519559.999, 1357519589.999, 1357519619.999,
1357519649.999, 1357519679.999, 1357519709.999, 1357519739.999,
1357519769.999, 1357519799.999, 1357519829.997, 1357519859.999,
1357519889.999, 1357519919.999, 1357519949.999, 1357519979.999,
1357520009.999, 1357520039.999, 1357520069.999, 1357520099.999,
1357520129.999, 1357520159.999, 1357520189.999, 1357520219.999,
1357520249.999, 1357520279.999, 1357520309.999, 1357520339.999,
1357520369.999, 1357520399.999), tzone = "", tclass = c("POSIXct",
"POSIXt"), class = c("POSIXct", "POSIXt")), count = c(20763L,
12030L, 22188L, 12183L, 21112L, 11628L, 21543L, 12609L, 20095L,
12992L, 21552L, 12447L, 21113L, 12236L, 21705L, 12018L, 21140L,
11820L, 21571L, 12803L, 21146L, 12081L, 21171L, 12440L, 21353L,
11708L, 21476L, 12210L, 21364L, 12041L, 21907L, 11934L, 22207L,
12403L, 21629L, 12676L, 21046L, 12196L, 21673L, 12190L, 21830L,
11652L, 20943L, 12350L, 20848L, 11800L, 21085L, 12367L, 21519L,
12325L, 22217L, 12195L, 22405L, 11869L, 21380L, 12145L, 21842L,
12224L, 21793L, 12856L, 34934L, 24073L, 41005L, 33964L, 46240L,
41287L, 52697L, 62618L, 78594L, 68193L, 76617L, 63747L, 90556L,
75830L, 104609L, 51063L, 67046L, 66977L, 82513L, 87228L, 107474L,
141878L, 127290L, 70953L, 98879L, 87814L, 117309L, 113463L, 150979L,
198271L, 170456L, 108325L, 119583L, 111803L, 117067L, 186768L,
226191L, 235546L, 228039L, 165570L, 159472L, 161707L, 137614L,
180049L, 254616L, 302166L, 336723L, 234902L, 202560L, 210679L,
173053L, 162839L, 262536L, 306859L, 249385L, 300646L, 219594L,
209819L, 166758L, 173716L, 268453L, 310940L, 264778L, 289798L,
202234L, 236882L, 217502L, 181157L, 196976L, 201901L, 228233L,
221241L, 220140L, 122623L, 76699L, 105589L, 381687L, 264571L,
187083L, 175972L, 202483L, 198547L, 196964L, 206402L, 181260L,
189319L, 162374L, 160412L, 186897L, 184529L, 160056L, 177326L,
184240L, 160864L, 156540L, 150392L, 157610L, 138447L, 148423L,
147318L, 148463L, 114389L, 163761L, 126624L, 167519L, 138240L,
133005L, 120187L, 155814L, 132751L, 140000L, 120323L, 124415L,
129450L, 116635L, 125364L, 108176L, 118877L, 143640L, 132457L,
118641L, 114330L, 135960L, 148066L, 130787L, 130230L, 130436L,
107109L, 129405L, 116093L, 135293L, 119048L, 147364L, 127028L,
145576L, 139960L, 139896L, 139433L, 127806L, 124845L, 141319L,
132821L, 129279L, 111905L, 130898L, 133135L, 138201L, 121460L,
143846L, 92964L, 100614L, 85637L, 139594L, 124302L, 106071L,
128247L, 120788L, 176300L, 144378L, 126209L, 117886L, 111001L,
105855L, 122387L, 152357L, 103217L, 134069L, 106021L, 91796L,
103335L, 99422L, 115839L, 147787L, 128868L, 123416L, 109312L,
129782L, 109397L, 130418L, 113709L, 103774L, 133272L, 137311L,
138079L, 132308L, 119744L, 164226L, 149361L, 135044L, 110185L,
151246L, 141811L, 160525L, 128407L, 159161L, 142969L, 150370L,
128705L, 151884L, 171663L, 150428L, 154910L, 165016L, 163729L,
169727L, 144913L, 163476L, 159984L, 155767L, 142334L, 177964L,
169230L, 135086L, 139350L, 174013L, 164427L, 154289L, 143392L,
187156L, 139426L, 159207L, 187435L, 198519L, 132559L, 163582L,
179069L, 150413L, 161463L, 173357L, 162457L, 136248L, 144086L,
151073L, 130237L, 144066L, 179840L, 135843L, 147757L, 206373L,
140734L, 177374L, 176168L, 154999L, 136136L, 187568L, 142357L,
152180L, 168528L, 131228L, 140622L, 145363L, 93070L, 58613L,
82024L, 86640L, 77493L, 71205L, 87641L, 89232L, 99214L, 89311L,
87948L, 90790L, 91326L, 106916L, 97318L, 89452L, 91658L, 82069L,
92559L, 89194L, 81721L, 83490L, 96388L, 90145L, 79861L, 90301L,
77676L, 262966L, 227355L, 256477L, 238905L, 241260L, 206168L,
229477L, 215515L, 245217L, 232026L, 225308L, 223537L, 198524L,
237840L, 233483L, 193081L, 216570L, 212949L, 203150L, 240861L,
209596L, 200673L, 180099L, 187726L, 187642L, 188402L, 176871L,
216090L, 203310L, 184723L, 195702L, 204137L, 276952L, 313717L,
323208L, 308448L, 321638L, 378236L, 352163L, 413678L, 395997L,
354317L, 366915L, 339465L, 346781L, 394895L, 355176L, 349618L,
417590L, 335474L, 405686L, 362581L, 356525L, 354142L, 383487L,
334305L, 327489L, 336201L, 374153L, 341485L, 321473L, 308773L,
15709L, 8870L, 15563L, 8944L, 15941L, 9342L, 16303L, 8951L, 14969L,
9385L, 14537L, 9963L, 15676L, 9011L, 16552L, 9587L, 16802L, 9693L,
15267L, 8946L, 14189L, 9067L, 14359L, 9776L, 167922L, 337364L,
350941L, 362928L, 364922L, 319641L, 348687L, 321356L, 400161L,
334171L, 332829L, 323842L, 397809L, 375694L, 384432L, 356825L,
350846L, 395942L, 359471L, 296926L, 418481L, 322144L, 335658L,
347212L, 334421L, 375769L, 364300L, 317370L, 373192L, 346713L,
356341L, 327225L, 305538L, 347815L, 276914L, 322149L, 303627L,
292363L, 284724L, 305082L, 373363L, 304386L, 438592L, 403579L,
430549L, 450536L, 432445L, 389779L, 434888L, 375010L, 456096L,
577393L, 451122L, 432354L, 425547L, 417729L)), .Names = c("time",
"count"), row.names = c(NA, -480L), class = "data.frame")
> dput(ev)
structure(list(dt = structure(c(1357508700, 1357510680, 1357512540,
1357515360, 1357517220, 1357517700, 1357518000, 1357518000, 1357519140,
1357519140), class = c("POSIXct", "POSIXt"), tzone = ""), event = structure(c(7L,
8L, 3L, 2L, 5L, 6L, 1L, 4L, 2L, 9L), .Label = c("Event 1",
"Event 2", "Event 3",
"Event 4", "Event 5",
"Event 6", "Event 7",
"Event 8", "Event 9"
), class = "factor")), .Names = c("dt", "event"), row.names = c(NA,
-10L), class = "data.frame")
Library Versions:
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-redhat-linux-gnu (64-bit)
attached base packages:
[1] grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] reshape2_1.2.2 xts_0.9-1 zoo_1.7-9 gdata_2.12.0 data.table_1.8.6 caTools_1.14
[7] scales_0.2.3 ggplot2_0.9.3
Simplied code - this still doesnt work
library(scales)
library(ggplot2)
taonedf<-dget("taonedf") #in this thread
ev<-dget("ev") #in this thread
ggplot(data=taonedf, aes(x=time, y=count/30)) +
geom_line() +
geom_vline(data=ev,aes(xtintercept=as.numeric(dt)))
To get geom_vline() display lines as intended, first, library scales should be loaded. Then use as.numeric() in geom_vline().
library(scales)
+ geom_vline(data=ev,aes(xintercept=as.numeric(dt)))
Two things
You need to wrap the datetimes for the vline in as.numeric
You misspelled xintercept
Fixing those:
library("ggplot2")
library("scales")
ggplot(data=taonedf, aes(x=time, y=count/30)) +
geom_line(color="#009E73") +
geom_vline(data=ev,aes(xintercept=as.numeric(dt)))+
scale_y_continuous(name="requests per second", labels = format_format(scientific=FALSE, big.mark=",")) +
scale_x_datetime(name="",labels = date_format("%b %d\n%H:%M") ) +
labs(title=paste("Requests per Second - All Requests")) +
theme(legend.position = "none")

Resources