I have data with id, start time, and end time.
ID start_time end_time 1 2017-12-29 03:52:06 2017-12-29 04:56:00 2 2017-12-29 04:12:34 2017-12-29 04:44:00 3 2017-12-29 04:24:36 2017-12-29 05:26:00 4 2017-12-29 04:30:00 2017-12-29 06:24:00 5 2017-12-29 04:33:28 2017-12-29 06:00:00 6 2017-12-29 04:52:08 2017-12-29 06:07:00 7 2017-12-29 05:13:48 2017-12-29 06:33:00 8 2017-12-29 05:33:53 2017-12-29 06:39:00 9 2017-12-29 05:40:00 2017-12-29 07:15:00 10 2017-12-29 05:30:40 2017-12-29 07:00:00 11 2017-12-29 06:08:15 2017-12-29 07:31:00 12 2017-12-29 06:12:33 2017-12-29 07:25:00 If I plot these time intervals, it looks like as follows:
library(ggplot2) ggplot(time_day1) + aes(x = start_time, xend = end_time, y = id, yend=id, colour = id) + geom_segment() + geom_point() + geom_point(aes(x = end_time )) + xlab("Time") + theme_bw() what I would like to plot is the series of the number of observations(ids) with the same x-axis (time) as a time-series plot. I'd appreciate if you provide the appropriate approach for this.
