Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
atalikami opened this issue Nov 26, 2015 · 3 comments · Fixed by #3688
Closed

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

atalikami opened this issue Nov 26, 2015 · 3 comments · Fixed by #3688

Comments

@atalikami
Copy link

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.

@arunsrinivasan arunsrinivasan changed the title Complex numbers not supported Support for grouping/ordering/computing on columns of type complex Nov 26, 2015
@arunsrinivasan arunsrinivasan added this to the v2.0.0 milestone Nov 26, 2015
@MichaelChirico
Copy link
Member

Merge this with #602?

@arunsrinivasan
Copy link
Member

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

@MichaelChirico
Copy link
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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants