[R] as.Date
Valeri Fabio
fvaleri at ispm.unibe.ch
Wed Feb 9 08:44:30 CET 2011
Hello,
I find out which package disturbs as.Date(). It is the package Epi:
> as.Date(36525, origin="1900-01-01")
[1] "2000-01-02"
> library(Epi)
> as.Date(36525, origin="1900-01-01")
[1] "2070-01-01"
> detach("package:Epi")
> as.Date(36525, origin="1900-01-01")
[1] "2000-01-02"
@Philipp: I assume that Epi will have the same affect on Linux. Maybe you have the same library or another which conflicts with as.Date().
Fabio
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Valeri Fabio
Sent: Mittwoch, 9. Februar 2011 08:12
To: r-help at r-project.org
Subject: Re: [R] as.Date
Thanks for the reply.
The original test was without the quote. The quote come into play when I try to solve this problem changing from " to '. However, after restarting my PC the
as.Date(36525, origin="1900-01-01")
gaves me the correct output
[1] "2000-01-02"
After loading several libraries I got
[1] "2070-01-01"
I assume there is a conflict with a package. I will try to find the one and let you know.
Fabio
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Prof Brian Ripley
Sent: Dienstag, 8. Februar 2011 18:45
To: Philipp Pagel
Cc: r-help at r-project.org
Subject: Re: [R] as.Date
On Tue, 8 Feb 2011, Philipp Pagel wrote:
>> I have a strange behavior of the as.Date() function. For example:
>> as.Date(36525, origin="1900-01-01'")
>>
>> I would expect to get 2000-01-01. But R gives me
>
> That's almost exactly what I get with R 2.11.1, LINUX (minus the
> one-day differnce which is probably correct, too lazy to count leap
> years...):
>
>> as.Date(36525, origin="1900-01-01'")
> [1] "2000-01-02"
>
> At first I thought the excess single quote maight be causingyour
> problem, but it doesn't for me.
>
> Maybe you need to upgrade R? Possibly it's an already fixed issue?
Or perhaps it is a problem with the OS services on the unstated R platform used (this will use strptime from the OS). The single quote is definitely wrong, however.
>
> cu
> Philipp
>
>
> --
> Dr. Philipp Pagel
> Lehrstuhl für Genomorientierte Bioinformatik
> Technische Universität München
> Wissenschaftszentrum Weihenstephan
> Maximus-von-Imhof-Forum 3
> 85354 Freising, Germany
> http://webclu.bio.wzw.tum.de/~pagel/
>
> ______________________________________________
> 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.
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
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.
More information about the R-help
mailing list