Yes, I have to agree. When trying to parse dates in R, I find it best to
stick to the "as.Date" function, which can convert multiple dates and
multiple formats without problems.

On Sun, 2010-06-06 at 06:24 -0700, Guy Green wrote:

> I may be missing something on this, but it seems timeDate is quite difficult
> to work with.  For example, the following code shows some dates working, and
> others not, but it is hard to see what the difference is except that
> timeDate has difficulty dealing with single digit dates:
> 
> timeDate("6/7/2010", format = "%m/%d/%Y")  #works fine
> timeDate("5/28/2010", format = "%m/%d/%Y")  #works fine
> timeDate(c("6/7/2010", "5/28/2010"), format = "%m/%d/%Y")  #doesn't work.  I
> have no idea why the dates work on their own (above), but not together.
> timeDate(c("06/07/2010", "05/28/2010"), format = "%m/%d/%Y")  #works - so
> the single/double issue seems to be the cause of the problem
> timeDate(c("06-07-2010", "05-28-2010"), format = "%m-%d-%Y")  #works fine
> 
> Could you just use as.Date?  Does this get you what you wanted?
> 
> date <- read.csv("D:/date.csv",header=T,sep=",")
> date2 = as.Date(date$Date, format = "%m/%d/%Y")
> date2
> 
> Guy



	[[alternative HTML version deleted]]

