Skip to content
Back to formatted view

Raw Message

Message-ID: <CAPtbhHyaJZBS0xoRNur9SsTiF+vQt5W3KCorVhuSJmA_=upgkQ@mail.gmail.com>
Date: 2017-03-09T07:05:03Z
From: Suzen, Mehmet
Subject: as.POSIXct behaviour
In-Reply-To: <CAJ=vYTFX25JxhXBzYbVo7qu=WDYc7UHWqjb+tmgqT_GUM6HUhQ@mail.gmail.com>

On 9 March 2017 at 01:29, Arunkumar Srinivasan
<arunkumar.sriniv at gmail.com> wrote:
> The time info is lost on the first index as well. And it happens *silently*.

Yes, because it assumes homogeneous format on the entire vector.  You
may want to
do  two passes with different formats or run a regular expression to
catch typos.

> lapply(x, as.POSIXct)
> 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,

This behaves differently because you are running as.POSIXct for each element
separately.