[R] How to plot dates

Jim Lemon drj|m|emon @end|ng |rom gm@||@com
Tue Mar 16 06:26:13 CET 2021


Hi Greg,
As the POSIX conversion part is already answered, I'll add:

as.Date("16/03/2021",format="%d/%m/%Y")

converts to Date object and

axis.Date()

will display dates on the date axis in base graphics.

Jim

On Tue, 16 Mar 2021, 08:33 Gregory Coats via R-help <r-help using r-project.org
wrote:

> 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
> gregcoats using me.com
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list