[datatable-help] problems with adding a DateTime column

Matthew Dowle mdowle at mdowle.plus.com
Thu Mar 8 17:39:48 CET 2012


Hi,

See Notes section of ?data.table, i.e., POSIXlt isn't supported and will
unlikely ever be because it's so dreadfully wasteful.

In addition to IDate and IDateTime,  POSIXct appears to work for some
people (even in keys), but note that the bug list has a few outstanding
issues wrt POSIXct.

I've added a FR to return a helpful error message such as "POSIXlt isn't
supported because ..." in this case.

Matthew

> Dear Datatable-Help:
> I'm running R version 2.14.1 and data.table 1.7.10 (on Windows 7 and
> Linux).  On both systems I get a strange result in the following toy
> example:
>
> test <- data.table(A=c(1,2,3))
> test[,B:= c("2011-01-01","2011-01-02","2011-01-03")]
> test[,C:=
> strptime(c("2011-01-01","2011-01-02","2011-01-03"),format="%Y-%m-%d")]
> Output:
>       A          B       C
> [1,]   1 2011-01-01 0, 0, 0
> [2,]   2 2011-01-02 0, 0, 0
> [3,]   3 2011-01-03 0, 0, 0
>
> Columns A and B show the expected behavior.  Column C was supposed to
> simply convert the date strings into DateTime types.  Clearly this is not
> happening.
>
> Please help.
> Regards,
> Alex
>
>
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help




More information about the datatable-help mailing list