[R] Convert character date time to R date-time variable.

Ebert,Timothy Aaron tebert @end|ng |rom u||@edu
Thu Dec 7 17:29:09 CET 2023


Look at the lubridate package in R.
Regards,
Tim

-----Original Message-----
From: R-help <r-help-bounces using r-project.org> On Behalf Of Sorkin, John
Sent: Thursday, December 7, 2023 11:22 AM
To: r-help using r-project.org (r-help using r-project.org) <r-help using r-project.org>
Subject: [R] Convert character date time to R date-time variable.

[External Email]

Colleagues,

I have a matrix of character data that represents date and time. The format of each element of the matrix is "2020-09-17_00:00:00"
How can I convert the elements into a valid R date-time constant?

Thank you,
John



John David Sorkin M.D., Ph.D.
Professor of Medicine, University of Maryland School of Medicine;

Associate Director for Biostatistics and Informatics, Baltimore VA Medical Center Geriatrics Research, Education, and Clinical Center;

PI Biostatistics and Informatics Core, University of Maryland School of Medicine Claude D. Pepper Older Americans Independence Center;

Senior Statistician University of Maryland Center for Vascular Research;

Division of Gerontology and Paliative Care,
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
Cell phone 443-418-5382



______________________________________________
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.



More information about the R-help mailing list