[R] date and chron library help...!

Gary Collins gco at eortc.be
Mon Oct 15 15:46:12 CEST 2001

Dear all,

I'm not sure whether this is a bug or not... But some help would be greatly appreciated.
I have a dataframe, which I read in using read.xport (from the foriegn library) as the orginal data is in SAS format.
3 columns of this dataset are supposed to be dates, but read.xport doesn't recognise them as dates (all columns are read in as mode numeric). So I load up the date library and go ahead to convert the 3 columns into dates.
So doing ...
> library(date)
> s05962$DOB_as.date(s05962$DOB)
> s05962$DOB    # to check if everything is ok, and it is...dates have been correctly converted...

However, when I look at the first 10 rows of the whole dataframe,
> s05962[1:10,]      # The column DOB is is still in numeric mode... So I try again, but the following occurs... 

> s05962$DOB_as.date(s05962$DOB)
Error in as.date(s05962$DOB) : Object "temp" not found

So not only do I not have the date columns correctly converted but when I try again I can't, unless I restart R.
I have no temp object in my workspace, the temp object refers to an object inside the as.date function...
BTW. I am using R-1.3.0... on windows 95.

Any help or is it a bug? I also tried using functions from the chron library, as.chron, and got dates but this time 10 years added on to them all (so another problem here as well), but the format of the columns with dates was ok using the as.chron function.  Am I doing something stupid?


Dr. Gary S. Collins,
Statistics Research Fellow,
Quality of Life Unit, 
European Organisation for Research and Treatment of Cancer, 
EORTC Data Center, 
Avenue E. Mounier 83, bte. 11,
B-1200 Brussels, Belgium.

Tel: +32 2 774 1 606
Fax: +32 2 779 4 568

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://stat.ethz.ch/pipermail/r-help/attachments/20011015/cdcea4b4/attachment.html

More information about the R-help mailing list