[datatable-help] assigning POSIXlt object to a data.table column
Matthew Dowle
mdowle at mdowle.plus.com
Mon Apr 22 14:40:25 CEST 2013
Hi,
It's burried in the Notes section of ?data.table :
" POSIXlt is not supported as a column type because it uses 40 bytes
to store a single datetime. Unexpected errors may occur if you manage to
create a column of type POSIXlt. Please see NEWS for 1.6.3, and
IDateTime instead. IDateTime has methods to convert to and from POSIXlt.
"
The no-support for POSIXlt is set in stone, but the advice there to
use IDateTime may not be the best. Bascially - anything but POSIXlt!
Btw, please don't assign to DT columns using DT$test<-. See ?":=".
Matthew
On 22.04.2013 13:27, Erik Iverson wrote:
> Hello,
>
> Hope all is well with everyone, just wondering if this is a
> data.table
> bug or a bug in my understanding:
>
>> DT <- data.table(x = 1)
>> DT$test <- as.POSIXlt(Sys.Date())
> Warning message:
> In `[<-.data.table`(x, j = name, value = value) :
> Supplied 9 items to be assigned to 1 items of column 'test' (8
> unused)
>
> Thanks!
> --Erik
>
> sessionInfo()
> R version 3.0.0 (2013-04-03)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=C LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] wordcloud_2.4 RColorBrewer_1.0-5 Rcpp_0.10.3
> tm_0.5-8.3
> [5] ggplot2_0.9.3.1 zoo_1.7-9 data.table_1.8.8
> XML_3.96-1.1
>
> loaded via a namespace (and not attached):
> [1] colorspace_1.2-2 compiler_3.0.0 dichromat_2.0-0 digest_0.6.3
> [5] grid_3.0.0 gtable_0.1.2 labeling_0.1
> lattice_0.20-15
> [9] MASS_7.3-26 munsell_0.4 plyr_1.8 proto_0.3-10
> [13] reshape2_1.2.2 scales_0.2.3 slam_0.1-28 stringr_0.6.2
> [17] tools_3.0.0
> _______________________________________________
> 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