title: Caused by error in `as.POSIXlt.character()`: ! character string is not in a standard unambiguous format. How can I change CHR to POSIXCT?
body: <p>I have a huge data frame called 'cyclist_trip_data_all'</p>
  <pre><code>head(cyclist_trip_data_all)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/qbwZj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qbwZj.png" alt="enter image description here" /></a></p>
  <p>The most important columns of dates have chr class and I need it to be converted to POSIXct for calculations.</p>
  <pre><code>combined_ctd &lt;-
    mutate(cyclist_trip_data_all, ride_length =
             difftime(ended_at,started_at,units='mins'))
  </code></pre>
  <p>The above throws the unambiguous format error at us and I'm pretty sure because the two columns are chr class.</p>
  <pre><code>cyclist_trip_data_all %&gt;%
      transmute(ended_at = as.POSIXct(ended_at,tz=&quot;&quot;,tryFormats=
                                      c(&quot;%Y-%m-%d %H:%M:%OS&quot;,
                                        &quot;%Y/%m/%d %H:%M:%OS&quot;,
                                        &quot;%Y-%m-%d %H:%M&quot;,
                                        &quot;%Y/%m/%d %H:%M&quot;,
                                        &quot;%Y-%m-%d&quot;,
                                        &quot;%Y/%m/%d&quot;)))
  head(cyclist_trip_data_all$ended_at)
  </code></pre>
  <p>Using the above code throws similar unambiguous format error:</p>
  <pre><code>Error in `transmute()`:
  ! Problem while computing `ended_at = as.POSIXct(...)`.
  Caused by error in `as.POSIXlt.character()`:
  ! character string is not in a standard unambiguous format
  Traceback:
  
  1. cyclist_trip_data_all %&gt;% transmute(ended_at = as.POSIXct(ended_at, 
   .     tz = &quot;&quot;, tryFormats = c(&quot;%Y-%m-%d %H:%M:%OS&quot;, &quot;%Y/%m/%d %H:%M:%OS&quot;, 
   .         &quot;%Y-%m-%d %H:%M&quot;, &quot;%Y/%m/%d %H:%M&quot;, &quot;%Y-%m-%d&quot;, &quot;%Y/%m/%d&quot;)))
  2. transmute(., ended_at = as.POSIXct(ended_at, tz = &quot;&quot;, tryFormats = c(&quot;%Y-%m-%d %H:%M:%OS&quot;, 
   .     &quot;%Y/%m/%d %H:%M:%OS&quot;, &quot;%Y-%m-%d %H:%M&quot;, &quot;%Y/%m/%d %H:%M&quot;, 
   .     &quot;%Y-%m-%d&quot;, &quot;%Y/%m/%d&quot;)))
  3. transmute.data.frame(., ended_at = as.POSIXct(ended_at, tz = &quot;&quot;, 
   .     tryFormats = c(&quot;%Y-%m-%d %H:%M:%OS&quot;, &quot;%Y/%m/%d %H:%M:%OS&quot;, 
   .         &quot;%Y-%m-%d %H:%M&quot;, &quot;%Y/%m/%d %H:%M&quot;, &quot;%Y-%m-%d&quot;, &quot;%Y/%m/%d&quot;)))
  4. mutate_cols(.data, dots, caller_env = caller_env())
  5. withCallingHandlers({
   .     for (i in seq_along(dots)) {
  </code></pre>
  <p>I've tried as.POSIXct(as.numeric(as.character())) function instead but it changes every date values in the column into NA introduced by coersion.</p>
  <p>Also tried:</p>
  <pre><code>cyclist_trip_data_all$ended_at &lt;- as.POSIXct(cyclist_trip_data_all$ended_at,format=&quot;%Y-%m-%d %H:%M:%S&quot;,tz=&quot;UTC&quot;)
  cyclist_trip_data_all$started_at &lt;- as.POSIXct(cyclist_trip_data_all$ended_at,format=&quot;%Y-%m-%d %H:%M:%S&quot;,tz=&quot;UTC&quot;)
  </code></pre>
  <p>And it also changes every value to NA.</p>
  <p>How do I actually change it to a POSIXct class without it becoming NA?</p>
  <p>To note, this error doesn't happen in RStudio but it's happening in my Kaggle notebook for R.</p>