[datatable-help] Bug with complex numbers

Paul Metzner paul.metzner at gmail.com
Mon Dec 3 12:03:40 CET 2012


Dear all,

I guess I found a bug in data.table. I have a data frame with complex numbers which I'd like to convert to a data table for aggregation. Most things work, for instance:

> > head(d)
>          	Fz	       Cz	         Pz  item
> 1: 0.002+0i 0.005+0i 0.054+0i  182
> 2: 1.567+0i 2.263+0i 1.547+0i  182
> 3: 0.314+0i 1.159+0i 3.841+0i  182
> 4: 0.507+0i 3.026+0i 6.783+0i  182
> 5: 2.086+0i 4.051+0i 1.159+0i  182
> 6: 0.344+0i 0.033+0i 2.282+0i  182

The data type is also ok:

> > str(d)
> Classes ‘data.table’ and 'data.frame':	128256 obs. of  4 variables:
>  $ Fz  : cplx  0.002+0i 1.567+0i 0.314+0i ...
>  $ Cz  : cplx  0.005+0i 2.263+0i 1.159+0i ...
>  $ Pz  : cplx  0.054+0i 1.547+0i 3.841+0i ...
>  $ item: int  182 182 182 182 182 182 182 182 182 182 ...
>  - attr(*, ".internal.selfref")=<externalptr> 

When I just call the object, I don't get head and tail as usually but the following message:

> > d
> Error in rbindlist(allargs) : Unsupported column type 'complex'

and when I want to set a key column for merging, I get:

> > setkeyv(d, c("item"))
> Error in setkeyv(d, c("item")) : 
>   don't know how to reorder type 'complex' of column 1. Please send this message to datatable-help

So that's what I did. Am I doing something wrong here or is this just a bug?

Best,
Paul


More information about the datatable-help mailing list