[R] problem with dates

sloan jones sledepi at operamail.com
Thu Sep 22 21:05:55 CEST 2005


I Have been trying to convert a vector of dates into julian dates using the following commands: as.date & as.numeric.  I can convert a date no problem by doing the following:

as.numeric (as.date ("9/21/2004"))

but as soon as I try to do an entire vector I am given the following:

 as.numeric (as.date(date1))
Error in as.date(date1) : Cannot coerce to date format

I have tried starting with a number of different date formats including dd/mm/yy, dd/mm/yyyy, month, day, year..

Following is a sample of the vector of dates that I am using:

> date1
  [1] 7/1/2005   4/27/2005  7/15/2004  11/30/2004 1/8/2005   2/7/2005  
  [7] 7/17/2004  4/1/2004   1/4/2005   12/27/2004 1/5/2005   5/17/2005 .... 

it is a factor and its mode is numeric.

What do I need to do?
 
Sloan

-- 
_______________________________________________
Surf the Web in a faster, safer and easier way:
Download Opera 8 at http://www.opera.com




More information about the R-help mailing list