Look at the lubridate package in R.
Regards,
Tim

-----Original Message-----
From: R-help <[email protected]> On Behalf Of Sorkin, John
Sent: Thursday, December 7, 2023 11:22 AM
To: [email protected] ([email protected]) <[email protected]>
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



______________________________________________
[email protected] 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.

______________________________________________
[email protected] 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.

Reply via email to