title: How to prevent write.csv from changing POSIXct, dates and times class back to character/factors?
body: <p>I have a .csv file with one field each for datetime, date and time.
  Originally they are all character fields and I have converted them accordingly.
  At the end of my code, if I do:</p>
  
  <pre><code>str(data)
  </code></pre>
  
  <p>I will get</p>
  
  <pre><code>datetime: POSIXct
  date: Date
  time: Class 'times'  atomic [1:2820392] (....) attr(*, "format")= chr "h:m:s"
  </code></pre>
  
  <p>Now, I am very happy with this and I want to create a .csv file, so this is what I have:</p>
  
  <pre><code>write.csv(data, file = "data.csv", row.names = FALSE)
  </code></pre>
  
  <p>I have also tried</p>
  
  <pre><code>write.table(data, "data.csv", sep = ",", row.names = FALSE)
  </code></pre>
  
  <p>And I get the same result with both, which is all my convertion gets lost when writing the new .csv: everything is back to being a character. </p>
  
  <p>I suspect I am missing some argument in the write function, but I have been searching all afternoon and I can't find out what. Can some please help?</p>