Function as.Date leading to error implying that strptime requires 3 arguments

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Function as.Date leading to error implying that strptime requires 3 arguments

Rob Balshaw

I'm using R V 2.2.1.  When I try an example from the as.Date help page,
I get an error.

> x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960")
> z <- as.Date(x, "%d%b%Y")
Error in strptime(x, format) : 2 arguments passed to 'strptime' which
requires 3
>

Any suggestions would be appreciated.  

Thanks,

Rob

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Function as.Date leading to error implying that strptime requires 3 arguments

Gabor Grothendieck
I can't reproduce this on my XP system:

> x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960")
> z <- as.Date(x, "%d%b%Y")
> z
[1] "1960-01-01" "1960-01-02" "1960-03-31" "1960-07-30"
> R.version.string # XP
[1] "R version 2.2.1, 2005-12-20"

I also tried it on 2.3.0 patched and could not reproduce it there
either.

On 5/19/06, Rob Balshaw <[hidden email]> wrote:

>
> I'm using R V 2.2.1.  When I try an example from the as.Date help page,
> I get an error.
>
> > x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960")
> > z <- as.Date(x, "%d%b%Y")
> Error in strptime(x, format) : 2 arguments passed to 'strptime' which
> requires 3
> >
>
> Any suggestions would be appreciated.
>
> Thanks,
>
> Rob
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Function as.Date leading to error implying that strptime requires 3 arguments

Prof Brian Ripley
In reply to this post by Rob Balshaw
Your system (unstated) is corrupted.  R runs its examples as part of it
test suite, so this is not an error in R 2.2.1 (which is not current: see
the posting guide which asked you to update *before* posting).  One
possibility is that you have strptime from a much earlier version of R in
use somehow.

I suggest you remove all versions of R from your system and reinstall one
latest version (2.3.1 beta).

On Fri, 19 May 2006, Rob Balshaw wrote:

>
> I'm using R V 2.2.1.  When I try an example from the as.Date help page,
> I get an error.
>
>> x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960")
>> z <- as.Date(x, "%d%b%Y")
> Error in strptime(x, format) : 2 arguments passed to 'strptime' which
> requires 3
>>
>
> Any suggestions would be appreciated.
>
> Thanks,
>
> Rob
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

--
Brian D. Ripley,                  [hidden email]
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Function as.Date leading to error implying that strptime requires 3 arguments

Rob Balshaw
Thank you to Prof Ripley, Gabor Grothendieck, Dirk Eddelbuettel and
others who emailed with suggestions and comments.

Dr Ripley's suggestion that I reinstall appears to have fixed the
problem, though I confess I have upgraded only to 2.3.0 rather than the
beta 2.3.1.  I use Windows XP Pro, Service Pack 2.0 -- my apologies for
not mentioning this.

While this instance was not serious, in itself, is it a symptom of
something more troubling?  I worry that some feature of my usage has led
to this problem.  However, if it were something I did regularly, then it
should recur.  At that time, I will certainly have to try to correct
whatever it happens to be.  

In the meantime, however, if anyone has any suggestions about what I
might have done to create this problem I'd be pleased to hear them.  I
do (or rather, did) have multiple versions of R installed, and I do make
extensive use of several libraries, including the Bioconductor set.  My
suspicion is that this would not occur if I were to remove old versions
when I upgrade.

Cheers,

Rob


-----Original Message-----
From: Prof Brian Ripley [mailto:[hidden email]]
Sent: Friday, May 19, 2006 11:39 PM
To: Rob Balshaw
Cc: [hidden email]
Subject: Re: [R] Function as.Date leading to error implying that
strptime requires 3 arguments

Your system (unstated) is corrupted.  R runs its examples as part of it
test suite, so this is not an error in R 2.2.1 (which is not current:
see the posting guide which asked you to update *before* posting).  One
possibility is that you have strptime from a much earlier version of R
in use somehow.

I suggest you remove all versions of R from your system and reinstall
one latest version (2.3.1 beta).

On Fri, 19 May 2006, Rob Balshaw wrote:

>
> I'm using R V 2.2.1.  When I try an example from the as.Date help
> page, I get an error.
>
>> x <- c("1jan1960", "2jan1960", "31mar1960", "30jul1960") z <-
>> as.Date(x, "%d%b%Y")
> Error in strptime(x, format) : 2 arguments passed to 'strptime' which
> requires 3
>>
>
> Any suggestions would be appreciated.
>
> Thanks,
>
> Rob
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>

--
Brian D. Ripley,                  [hidden email]
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

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Function as.Date leading to error implying that strptime requires 3 arguments

Martin Maechler
>>>>> "Rob" == Rob Balshaw <[hidden email]>
>>>>>     on Fri, 26 May 2006 07:50:16 -0700 writes:

    Rob> Thank you to Prof Ripley, Gabor Grothendieck, Dirk Eddelbuettel and
    Rob> others who emailed with suggestions and comments.

    Rob> Dr Ripley's suggestion that I reinstall appears to have fixed the
    Rob> problem, though I confess I have upgraded only to 2.3.0 rather than the
    Rob> beta 2.3.1.

Not wise, I would bet quite a heap that 2.3.1 beta has less bugs
than 2.3.0 and is otherwise very close.
Note that it's always a good idea to upgrade to patch releases -
even beta ones.  I could understand your reluctance better had
it been the matter of upgrading to a  x.(y+1).0 beta.

Martin

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Loading...