Skip to content

Date conversion problems

3 messages · John Carew, Don MacQueen, Thomas Lumley

#
Hello,
I have a data set with dates stored as a factor with levels coded as, for
example  "01/03/1996" 

I tried the following:

onset <- strptime(as.character(cf$dx.dt), format="%m%d%Y")

where cf$dx.dt are the dates in the data frame cf.  For output, I get NA
for every entry.  If it matters, I'm running the fink version of R 1.6.1
on a powerbook G4 with OS 10.2.2.  

I have little experience dealing with dates in R.  Is there a reference
that discusses the general issues?

Any help would be much appreciated. 
Thanks,
John

--
John Carew <jcarew@stat.wisc.edu>
Department of Statistics
University of Wisconsin--Madison
http://www.stat.wisc.edu/~jcarew
#
Try format="%m/%d/%Y"

The help pages are pretty good, and the examples in ?strptime show 
something quite similar to your case.

Vol. 1/2 of R News (available at the R website) has the article that 
introduced the POSIXt classes.

-Don

  
    
#
On Sun, 2 Feb 2003, John Carew wrote:

            
If the dates look like "01/03/1996" then the format is "%m/%d/%Y"

	-thomas