[R] read.table behavior for Dates.

David Scott d.scott at auckland.ac.nz
Sat Apr 17 07:24:18 CEST 2010


Jeroen Ooms wrote:
> Ah Phil Spector is right, nothing is converted. I'm almost too embarrassed to
> admit it, but actually, it was Excel that tricked me. It displays date
> fields differently than they are stored in the csv file, and once you press
> 'save', it saves everything to a different format, completely unasked.

Exactly. There are some devastating gotchas with Excel and dates.

For example, in a medical study I was analysing, Excel decided that a NZ 
National Health Index number of AUG1838 was a date and converted it to 
Aug-99.

My rule is never, ever, ever save a .csv file from within Excel. Use 
.csv files created by other software, yes, but not one saved from within 
Excel.

David Scott



> 
> Nevertheless I got some valuable insight in the topic. What I'm trying to do
> here is make it easier for people to upload files that might contain dates
> to my webapp at yeroon.net/ggplot2. Currently, dates are imported as
> factors. I would like to implement something that Henrique described, to
> automatically convert variables to Date that are obviously dates.
> 


-- 
_________________________________________________________________
David Scott	Department of Statistics
		The University of Auckland, PB 92019
		Auckland 1142,    NEW ZEALAND
Phone: +64 9 923 5055, or +64 9 373 7599 ext 85055
Email:	d.scott at auckland.ac.nz,  Fax: +64 9 373 7018

Director of Consulting, Department of Statistics



More information about the R-help mailing list