I am looking to email a nicely formatted table from R using xtable. I found this thread explaining how to email an xtable easily, which works and the table looks great. However each time I do my date/time columns convert to numeric.
My email code:
body=print(xtable(myData), type="html")
My dates convert from YYYY-MM-DD hh:mm:ss to numeric (e.g. 1508117307.17). I've tried a number of ways to try to convert it back using things like transform and as.Date(), but no matter what I do the dates still convert to numeric.
Is it possible to coerce xtable to retain my original date/time format?
Thank you!
Convert the date to character using as.character()
before printing the table should do the job.
Disclaimer: I moved this answer here from the comments so other users can make use of the solution.