title: rbind converts POSIXct to character - How to convert back to POSIXct?
body: <p>Despite using the stringsASFactors = FALSE argument, rbind() is converting my POSIXct vectors into class character. I've checked out discussions on cbind/rbind type functions and how they handle POSIXct (see <a href="https://stackoverflow.com/questions/29369336/how-to-use-rbind-to-merge-data-tables-with-posixct-and-date-column-classes">here</a>, <a href="https://stackoverflow.com/questions/6100746/unexpected-rbind-fill-behavior">here</a>, and <a href="https://stackoverflow.com/questions/46686555/strptime-in-r-converts-timestamp-class-from-posixct-to-character">here</a>) but unfortunately they don't help in this case.</p>
  <p>Here I create POSIXct vectors as the basis for the rows within a dataframe.  When I use rbind() withing as.data.frame() and use stringsASFactors = FALSE, the POSIXct values are changed to class character.  I do know that it is rbind() and not as.data.frame() that is converting the class and there does not seem to be any way of preventing this.</p>
  <p>While I'm familiar with various date time structures, I did some research and I have no clue what system it is using to store the date-time or how to convert it back (yes, I already tried as.POSIXct()).</p>
  <p>So the question is, how do I convert these back to POSIXct? (If there is some magical way to have rbind() not convert POSIXct to character, I'll take that too.)
  Thanks!</p>
  <pre><code>####Build example####
  d1 &lt;- as.POSIXct(&quot;2020-06-30 8:00&quot;)
  d2 &lt;- as.POSIXct(&quot;2020-06-30 9:00&quot;)
  d3 &lt;- as.POSIXct(&quot;2020-06-30 10:00&quot;)
  d4 &lt;- as.POSIXct(&quot;2020-06-30 16:00&quot;)
  s1 &lt;- c(d1, d2, d3, d4, &quot;&quot;, &quot;&quot;)  
  
  d1 &lt;- as.POSIXct(&quot;2020-06-30 8:00&quot;)
  d2 &lt;- as.POSIXct(&quot;2020-06-30 10:00&quot;)
  d3 &lt;- as.POSIXct(&quot;2020-06-30 11:00&quot;)
  d4 &lt;- as.POSIXct(&quot;2020-06-30 12:00&quot;)
  d5 &lt;- as.POSIXct(&quot;2020-06-30 12:30&quot;)
  d6 &lt;- as.POSIXct(&quot;2020-06-30 16:30&quot;)
  s2 &lt;- c(d1, d2, d3, d4, d5, d6)
  
  d1 &lt;- as.POSIXct(&quot;2020-06-30 8:00&quot;)
  d2 &lt;- as.POSIXct(&quot;2020-06-30 13:00&quot;)
  d3 &lt;- as.POSIXct(&quot;2020-06-30 13:45&quot;)
  d4 &lt;- as.POSIXct(&quot;2020-06-30 16:30&quot;)
  s3 &lt;- c(d1, d2, d3, d4, &quot;&quot;, &quot;&quot;)
  
  d3 &lt;- as.POSIXct(&quot;2020-06-30 13:25&quot;)
  s4 &lt;- c(d1, d2, d3, d4, &quot;&quot;, &quot;&quot;)
  
  d2 &lt;- as.POSIXct(&quot;2020-06-30 16:00&quot;)
  s5 &lt;- c(d1, d2, &quot;&quot;, &quot;&quot;, &quot;&quot;, &quot;&quot;)
  
  ####Build data frame####
  timedata &lt;- as.data.frame(rbind(s1, s2, s3, s4, s5), stringsAsFactors = FALSE)
  names(timedata) &lt;- c(&quot;T1&quot;, &quot;T2&quot;, &quot;T3&quot;, &quot;T4&quot;, &quot;T5&quot;, &quot;T6&quot;)
  for(c in seq(from = 1, to = 6, by = 1)) {
    timedata[,c] &lt;- as.POSIXct(timedata[,c], tzone = &quot;PDT&quot;)
  }
  </code></pre>
  <p>P.S. There is some documentation for as.POSIXct() which discusses how to convert gibberish with a specific origin back into a functional POSIXct. But the examples are using the varying structures provided by SAS, SPSS, STATA, and Matlab, not internal R.</p>