Skip to content
Prev 33796 / 398513 Next

Help on using read.table with files containing dates

On Wed, 25 Jun 2003, Chriss, Neil wrote:

            
Unfortuantely them appear to contain perversions of dates, not the dates 
recognised by the ISO standard.  I read your dates as the first of
Jan, Apr and May 2003, but some illogical people use mm/dd/yy order.
It is not:  mode is inappropriate here: you actually have a factor
whose mode is numeric.  Use class(), not mode().
Yes, that's what the argument colClasses is for.  But since as.date is
not part of R (it is in contributed packages survival and date) you will 
need to provide an as() method.

I suggest you use

sampData[["Date"]] <- strptime(as.character(sampData[["Date"]]), "%d/%m/%y")

since the conversion to factor can be undone very easily.