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

2023-12-08 Thread Duncan Murdoch
On 08/12/2023 4:30 p.m., David Winsemius wrote: On 12/7/23 08:21, Sorkin, John wrote: 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

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

2023-12-08 Thread David Winsemius
On 12/7/23 08:21, Sorkin, John wrote: 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? You will not be able to store these

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

2023-12-08 Thread Martin Maechler
17_00:00:00", format = "%Y-%m-%d_%H:%M:%S") [1] "2020-09-17 CEST" > (in my time zone). > -Original Message- From: R-help > On Behalf Of Sorkin, John > Sent: Thursday, December 7, 2023 11:22 AM To: > r-help@r-project.org (r-help@r-

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

2023-12-07 Thread Dirk Eddelbuettel
`anytime` was written for this: > anytime::anytime("2020-09-17_00:00:00") [1] "2020-09-17 CDT" > class(anytime::anytime("2020-09-17_00:00:00")) [1] "POSIXct" "POSIXt" > Dirk -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org

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

2023-12-07 Thread Rui Barradas
Às 16:30 de 07/12/2023, Rui Barradas escreveu: Às 16:21 de 07/12/2023, Sorkin, John escreveu: 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

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

2023-12-07 Thread Rui Barradas
Às 16:21 de 07/12/2023, Sorkin, John escreveu: 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

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

2023-12-07 Thread Ebert,Timothy Aaron
Look at the lubridate package in R. Regards, Tim -Original Message- From: R-help On Behalf Of Sorkin, John Sent: Thursday, December 7, 2023 11:22 AM To: r-help@r-project.org (r-help@r-project.org) Subject: [R] Convert character date time to R date-time variable. [External Email

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

2023-12-07 Thread Sorkin, John
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