From arunkumar.sriniv at gmail.com  Thu Mar  9 01:29:00 2017
From: arunkumar.sriniv at gmail.com (Arunkumar Srinivasan)
Date: Wed, 8 Mar 2017 16:29:00 -0800
Subject: [Rd] as.POSIXct behaviour
Message-ID: <CAJ=vYTFX25JxhXBzYbVo7qu=WDYc7UHWqjb+tmgqT_GUM6HUhQ@mail.gmail.com>

Dear R-devel, I have tested the code below on R v3.3.2 and v3.3.3 on
Mac and Windows.

x <- c("2017-01-01 05:00:02", "2017-01-02 03 :M:00") # note the ? :M?
in 2nd value
as.POSIXct(x)
# [1] "2017-01-01 GMT" "2017-01-02 GMT?

The time info is lost on the first index as well. And it happens *silently*.

On the other hand, if I do:

lapply(x, as.POSIXct)
#?[[1]]
#?[1] "2017-01-01 05:00:02 GMT"
#
#?[[2]]
# [1] "2017-01-02 GMT?

A list is returned, but values are as I?d expect. Would it be possible
to retain the time info with as.POSIXct(x) directly as well? If not,
what?s the rationale? In addition, I think a warning message that some
malformed timestamps were found would be very useful.

Thank you,
Arun.



[Rd] as.POSIXct behaviour
Arunkumar Srinivasan