Re: [R] as.Date() clarification

From: Peter Dalgaard <P.Dalgaard_at_biostat.ku.dk>
Date: Thu, 03 Jul 2008 12:07:41 +0200

Ron Michael wrote:
> When I use the code as.Date(0) the I get : "1970-01-01". My question is why it is like that? help file on as.Date seems to give no light on that. Can anyone clarify me?
>
Which version of R is this?

R version 2.7.1 (2008-06-23)
...
> as.Date(0)

Error in as.Date.numeric(0) : 'origin' must be supplied

and the help page has the explanation.

Internally, Date objects are represented as days since 1970-01-01, and you can still exploit that with

> structure(0,class="Date")

[1] "1970-01-01"

although you really shouldn't need to have and shouldn't have to use that knowledge.

[By the way, there used to be a way to see the current help pages on the web, but I can't remember how. Searching for as.Date via the R search sites doesn't help either (interesting set of sponsored links from Google though...), and the Wiki interface to help pages appears to be broken.]
>
> Regards,
>
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> [[alternative HTML version deleted]]
>

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard_at_biostat.ku.dk)              FAX: (+45) 35327907

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 03 Jul 2008 - 10:30:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 03 Jul 2008 - 21:32:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive