How to prevent write.csv from changing POSIXct, dates and times class back to character/factors?

后端 未结 3 347
既然无缘
既然无缘 2021-01-03 04:50

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

3条回答
  •  执念已碎
    2021-01-03 05:20

    According to ?write.table:

    Any columns in a data frame which are lists or have a class (e.g. dates) will be converted by the appropriate 'as.character' method: such columns are unquoted by default.

    Simply put, you can only write text/characters to text files. Use save if you want to preserve the binary R representation of your object(s).

提交回复
热议问题