Skip to content

confusing POSIXlt warning #2068

Closed
Closed
@tdhock

Description

@tdhock

Hey guys thanks for all your hard work making data.table great!

Can you please clarify the warning that is issued when strptime is used inside of the second argument of [.data.table? Right now it says "POSIXlt column type detected and converted to POSIXct" even in cases when strptime does not operate on columns at all.

For example this is a MRE which is potentially confusing:

> data.table(X=1)[, { strptime("1984-03-17", "%Y-%m-%d"); X}]
[1] 1
Warning message:
In strptime("1984-03-17", "%Y-%m-%d") :
  POSIXlt column type detected and converted to POSIXct. We do not recommend use of POSIXlt at all because it uses 40 bytes to store one date.
> devtools::session_info()
Session info -------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.3 (2017-03-06)
 system   i686, linux-gnu             
 ui       X11                         
 language en_US                       
 collate  en_US.UTF-8                 
 tz       posixrules                  
 date     2017-03-20                  

Packages -----------------------------------------------------------------------
 package       * version    date       source                                  
 bitops          1.0-6      2013-08-17 CRAN (R 3.2.2)                          
 caTools         1.17.1     2014-09-10 CRAN (R 3.2.2)                          
 colorspace      1.3-0      2016-11-01 R-Forge (R 3.3.1)                       
 data.table    * 1.10.5     2017-03-20 Github (Rdatatable/data.table@ce00cb1)  
 devtools        1.12.0     2016-12-05 CRAN (R 3.3.3)                          
 digest          0.6.10     2016-08-02 CRAN (R 3.2.2)                          
 ggplot2       * 2.1.0      2016-11-09 Github (faizan-khan-iit/ggplot2@5fb99d0)
 gtable          0.2.0      2016-02-26 CRAN (R 3.2.2)                          
 lattice       * 0.20-34    2016-09-06 CRAN (R 3.3.3)                          
 memoise         1.0.0      2016-01-29 CRAN (R 3.2.2)                          
 munsell         0.4.3      2016-02-13 CRAN (R 3.2.2)                          
 namedCapture  * 2015.12.01 2015-12-21 Github (tdhock/namedCapture@0517592)    
 plyr            1.8.4      2016-06-08 CRAN (R 3.2.2)                          
 RColorBrewer  * 1.1-2      2014-12-07 CRAN (R 3.2.2)                          
 Rcpp            0.12.9     2017-01-14 cran (@0.12.9)                          
 RCurl         * 1.96-0     2016-08-07 local                                   
 requireGitHub * 2014.4.4   2016-08-13 local                                   
 RJSONIO       * 1.3-0      2014-07-28 CRAN (R 3.2.2)                          
 RSelenium     * 1.3.6      2016-11-09 Github (ropensci/RSelenium@22f06b9)     
 scales          0.4.1      2016-11-09 CRAN (R 3.3.1)                          
 withr           1.0.1      2016-02-04 CRAN (R 3.2.2)                          
 XML           * 3.99-0     2016-08-07 local                                   
> 

I'm not sure there should be a warning at all in this case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions