[R] as.Date

David Winsemius dwinsemius at comcast.net
Tue Feb 8 17:45:14 CET 2011


On Feb 8, 2011, at 11:15 AM, Valeri Fabio wrote:

> Hi everybody,
>
>
>
> I have a strange behavior of the as.Date() function.

No, you have a programming error.

> For example:
>
>
>
> as.Date(36525, origin="1900-01-01'")

You have a superfluous "'"

 > as.Date(36525, origin="1900-01-01")
[1] "2000-01-02"

>
>
>
> I would expect to get 2000-01-01. But R gives me
>
>
>
> [1] "2070-01-01"
>
>
>
> I tried with several origins but the results are still the same. It
> seems that the origin does not apply and remains 1970-01-01.
>
>
>
> Does anyone can give me a hint  how to solve this problem?
>
>
>
> Thanks very much.
>
>
>
> Fabio
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
> ---
>
> Fabio Valeri, MSc
>
> University of Bern
>
> Institute of Social and Preventive Medicine
>
> Division of International & Environmental Health
>
> Finkenhubelweg 11 - CH-3012 Bern
>
> Tel +41 (0)31 631 35 10 - Fax +41 (0)31 631 35 20 - www.ispm.ch
>
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list