[R] Preserving dates in Excel.
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Jun 14 14:47:10 CEST 2007
On Thu, 14 Jun 2007, Patnaik, Tirthankar wrote:
> Hi,
> Quick question: Say I have a date variable in a data frame or
> matrix,
Which? It matters: see the help page.
> and I'd like to preserve the date format when using write.table.
> However, when I export the data, I get the generic number underlying the
> date, not the date per se, and a number such as 11323, 11324, etc are
> not meaningful in Excel. Is there any way I can preserve the format of a
> date on writing into a text-file?
Yes, see the help page and use a data frame. E.g.
> write.table(data.frame(x=.leap.seconds[1:3]), "")
"x"
"1" 1972-07-01 01:00:00
"2" 1973-01-01 00:00:00
"3" 1974-01-01 00:00:00
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list