Gregory myDat <- data.frame(datetime = c("2021-03-11 10:00:00","2021-03-11 14:17:00","2021-03-12 05:16:46","2021-03-12 09:17:02", "2021-03-12 13:31:43","2021-03-12 22:00:32","2021-03-13 09:21:43","2021-03-13 13:51:12", "2021-03-13 18:03:13","2021-03-13 22:20:28","2021-03-14 08:59:03","2021-03-14 13:15:56", "2021-03-14 17:25:23","2021-03-14 21:36:26"))
# convert date to date time object myDat$ datetime <- as.POSIXlt(myDat$ datetime, tz = "", format = "%Y-%M-%d %H:%M:%OS") # plotting ggplot(myDat, aes(datetime, <y variable>)) ..... Jeff -----Original Message----- From: R-help <r-help-boun...@r-project.org> On Behalf Of Gregory Coats via R-help Sent: Monday, March 15, 2021 4:34 PM To: r-help mailing list <r-help@r-project.org> Subject: [R] How to plot dates I store in a text file the dates and times that an event occurred. How do I direct R to import these text characters, and store the year, month, day, hour, minute, and second as a date? How do I then plot this series of dates? 2021-03-11 10:00:00 2021-03-11 14:17:00 2021-03-12 05:16:46 2021-03-12 09:17:02 2021-03-12 13:31:43 2021-03-12 22:00:32 2021-03-13 09:21:43 2021-03-13 13:51:12 2021-03-13 18:03:13 2021-03-13 22:20:28 2021-03-14 08:59:03 2021-03-14 13:15:56 2021-03-14 17:25:23 2021-03-14 21:36:26 Greg Coats gregco...@me.com [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.