Skip to content

transforming number from cal.yr() back to Date

1 message · BXC (Bendix Carstensen)

#
I got this problem presented, and I think it is of general interest for the
list. I copy it by agreement with Tina.

Best,
Bendix

-----Original Message-----
From: BXC (Bendix Carstensen)
Sent: Monday, February 13, 2006 6:54 PM
To: 'Zagar Tina'
Subject: RE: transforming number from cal.yr() back to date
Dear Tina,

I was a bit surprised myself, because if you do:
[1] as.Date.character as.Date.date      as.Date.dates     as.Date.default 
[5] as.Date.factor    as.Date.POSIXct   as.Date.POSIXlt 

there is no as.Date.numeric. But a date is merely the number of days since
1 Jan 1970, equipped with the class "Date", so below is two ways of doing it:
[1] 1994.263
[1] "1994-04-07"
[1] "1994-04-07"

Best,
Bendix
----------------------
Bendix Carstensen
Senior Statistician
Steno Diabetes Center
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 30 75 87 38
fax: +45 44 43 07 06
bxc at steno.dk
www.biostat.ku.dk/~bxc