From ggrothendieck at myway.com  Sun Oct 10 18:15:09 2004
From: ggrothendieck at myway.com (Gabor Grothendieck)
Date: Sun Oct 10 18:15:16 2004
Subject: [Rd] strange behaviour in R 2.0.0 (PR#7275)
References: <20041010155306.73761EDE3@slim.kubism.ku.dk>
Message-ID: <loom.20041010T180709-445@post.gmane.org>

 <xiao.gang.fan1 <at> libertysurf.fr> writes:

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

Normally if one wants to store a POSIXt object in a data frame, one uses
POSIXct, not POSIXlt:

a <- data.frame(x = 1:2)
a$y <- as.POSIXct(strptime(c("20010101","20020101"),"%Y%m%d"))

Actually in this instance you are not using times at all so you
might be better off using the simpler Date class:

a <- data.frame(x = 1:2)
a$y <- as.Date(c("20010101","20020101"),"%Y%m%d")


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