[Rd] strange behaviour in R 2.0.0 (PR#7275)

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Oct 10 18:20:59 CEST 2004


This is the fourth bug report today from Xiao Gang FAN, and we have had no
response to replies to the first three.  Please do not send bug reports 
unless you are prepared to take responsibility for them and answer 
requests for further information.

Please read the posting guide and the FAQ and use a meaningful subject 
line.

Now, where is the requested code to reproduce PR#7272?


On Sun, 10 Oct 2004 xiao.gang.fan1 at libertysurf.fr wrote:

> Full_Name: Xiao Gang FAN
> Version: R 2.0.0
> OS: Windows
> Submission from: (NULL) (82.226.247.142)
> 
> 
> The following codes worked for R 1.9.1
> 
> > a = data.frame(x=1:2)
> > a$y = strptime(c("20010101","20020101"),"%Y%m%d")
> 
> this no longer works for R 2.0.0:
> 
> Error in "$<-.data.frame"(`*tmp*`, "y", value = list(sec = c(0, 0), min = c(0, 
> : 
>         replacement has 9 rows, data has 2

That code is indeed incorrect, and did fail in 1.9.1:

R : Copyright 2004, The R Foundation for Statistical Computing
Version 1.9.1  (2004-06-21), ISBN 3-900051-00-3

> a = data.frame(x=1:2)
> a$y = strptime(c("20010101","20020101"),"%Y%m%d")
Error in "$<-.data.frame"(`*tmp*`, "y", value = strptime(c("20010101",  :
        replacement has 9 rows, data has 2

It even failed in 1.8.0.  It `worked' in 1.7.0, but did not do what you
most likely wanted it to do (see the NEWS for 1.8.0).  You cannot sensibly
add "POSIXlt" objects to a data frame: you can add "POSIXct" objects.

-- 
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



More information about the R-devel mailing list