Skip to content

Support for grouping/ordering/computing on columns of type complex #1444

Closed

Description

@atalikami

Hello,

The only question or information I can find on this is one I asked myself on stack overflow (http://stackoverflow.com/questions/32570742/r-data-table-package-and-complex-values) but it wasn't ever resolved.

The data.table package does not appear to support complex numbers, even though there was a specific bug fix addressing the problem, issue #982. I have updated to the latest development version, 1.9.7.

Now, I can have a data table which contains complex numbers, but nothing can then be done to it. For example:

stacktest<-data.table(x=complex(real=1:60, imaginary=-1:-60),y=LETTERS[1:10],z=rep(1:2,5))

This works, the data.table exists. However, if I try and use the setkey command:

setkey(stacktest, z)

Error in setkeyv(x, cols, verbose = verbose, physical = physical) : 
  Item 1 of list is type 'complex' which isn't yet supported

Or, if I try and run a function (any function as far as I can tell, I first discovered this trying to use dcast) on a subset of the data:

stacktest2<-stacktest[,.(abs(.SD)),by=.(y)]

Error in `[.data.table`(stacktest, , .(abs(.SD)), by = .(y)) : 
  Type 15 in .SD column 0

Being as issue #982 was specific to allowing complex numbers to work, I feel as though this is a bug, not a feature request.

Thanks.

Activity

  1. changed the title [-]Complex numbers not supported[/-] [+]Support for grouping/ordering/computing on columns of type complex[/+] on Nov 26, 2015
  2. added this to the milestone on Nov 26, 2015
  3. MichaelChirico commented on Aug 3, 2016

    @MichaelChirico
    Member

    Merge this with #602?

  4. arunsrinivasan commented on Aug 3, 2016

    @arunsrinivasan
    Member

    This issue is more detailed.. will close the other one.

  5. removed this from the milestone on May 10, 2018
  6. MichaelChirico commented on Jul 10, 2019

    @MichaelChirico
    Member

    Came across this again in working on #3639. Strange that you can't order any table with complex values, considering forder works just fine:

    # works fine
    stacktest_keyed = copy(stacktest[order(z)])
    setkey(stacktest_keyed, z)
    
    # is essentially the same thing? but fails
    setkey(stacktest, z)
    
  7. added a commit that references this issue on Jul 10, 2019
    73a63ca
  8. added this to the 1.12.4 milestone on Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions