[datatable-help] "Error in Ops.POSIXt" using 1.9.x

Arunkumar Srinivasan aragorn168b at gmail.com
Mon Mar 24 12:23:08 CET 2014


Hello,

Yes this seems to be a bug introduced sometime towards the end of the development cycle towards 1.9.x. Thanks for reporting. Will try to fix asap.

The problem is that `by=` doesn't retain the class. If you do: `dt[, print(d), by=list(id, d)]` you'll see that. For now, I guess you'll have to explicitly convert it back to POSIX/Date class and do your operations in `j`, until a commit with the fix is rolled out.

Arun

From: dnlbrky danielrlabar at gmail.com
Reply: dnlbrky danielrlabar at gmail.com
Date: March 24, 2014 at 6:36:41 AM
To: datatable-help at lists.r-forge.r-project.org datatable-help at lists.r-forge.r-project.org
Subject:  [datatable-help] "Error in Ops.POSIXt" using 1.9.x  

Running the following using data.table version 1.8.10 or 1.8.11 (Windows 7)  
works as expected:  

n <- 12  
dt <- data.table(id=rep(letters[1:(n/3)], each=3),  
d=seq(as.POSIXct("2013-01-01"), by="month", length.out=n))  
dt[, list(d2=seq(d, dt[, max(d)], by="month")), by=list(id, d)][1:15]  

> id d d2  
> 1: a 2013-01-01 2013-01-01  
> 2: a 2013-01-01 2013-02-01  
> 3: a 2013-01-01 2013-03-01  
> 4: a 2013-01-01 2013-04-01  
> 5: a 2013-01-01 2013-05-01  
> 6: a 2013-01-01 2013-06-01  
> 7: a 2013-01-01 2013-07-01  
> 8: a 2013-01-01 2013-08-01  
> 9: a 2013-01-01 2013-09-01  
> 10: a 2013-01-01 2013-10-01  
> 11: a 2013-01-01 2013-11-01  
> 12: a 2013-01-01 2013-12-01  
> 13: a 2013-02-01 2013-02-01  
> 14: a 2013-02-01 2013-03-01  
> 15: a 2013-02-01 2013-04-01  

After upgrading to 1.9.x (latest version at writing was 1.9.3) however, I  
get the following:  

>Error in Ops.POSIXt(del, by) : '/' not defined for "POSIXt" objects  

If I replace `seq` with `seq.Date` then I get:  

>Error in seq.Date(d, dt[, max(d)], by = "month") :  
'from' must be a "Date" object  

Am I doing something wrong? Is this a bug? Is there a workaround?  



--  
View this message in context: http://r.789695.n4.nabble.com/Error-in-Ops-POSIXt-using-1-9-x-tp4687400.html  
Sent from the datatable-help mailing list archive at Nabble.com.  
_______________________________________________  
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  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/datatable-help/attachments/20140324/aa4490b5/attachment.html>


More information about the datatable-help mailing list