8000 [R-Forge #2422] Handle columns with complex numbers · Issue #602 · Rdatatable/data.table · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[R-Forge #2422] Handle columns with complex numbers #602

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

Closed
arunsrinivasan opened this issue Jun 8, 2014 · 3 comments
Closed

[R-Forge #2422] Handle columns with complex numbers #602

arunsrinivasan opened this issue Jun 8, 2014 · 3 comments

Comments

@arunsrinivasan
Copy link
Member

Submitted by: Paul Metzner; Assigned to: Nobody; R-Forge link

Necessary to use data.table for signal processing, especially for the analysis of power spectra.

@MichaelChirico
Copy link
Member
MichaelChirico commented Mar 18, 2016

I suppose this issue is open because complex columns are not feature-complete?

E.g,

set.seed(102439)
DT <- data.table(C = c(1+2i, 1+2i, 1-2i, 1-2i), 
                 N = runif(4), I = c(1L, 1L, 2L, 2L))
DT[ , .N, by = C]

Error in``[.data.table(DT, , .N, by = C):
column or expression 1 of `by` or `keyby` is type `complex`. Do not quote column names. Usage: `DT[,sum(colC),by=list(colA,month(colB))]`

Other standard operations seem to work:

DT[, abs(C)]
# [1] 2.236068 2.236068 2.236068 2.236068

Though not always...

DT[ , sum(C), by = I]

Error in gsum(C) :
Type complex not supported by GForce sum (gsum). Either add the prefix base::sum(.) or turn off GForce optimization using options(datatable.optimize=1)

But

DT[ , base::sum(C), by = I]

Error in``[.data.table(DT, , base::sum(C), by = I) :
Type 15 in `.SD` column 0

@jangorecki
Copy link
Member

The last one DT[ , base::sum(C), by = I] looks like a bug. This sapply(split(DT$C, DT$I), sum) works.

@arunsrinivasan
Copy link
Member Author

dup of #1444.

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

No branches or pull requests

4 participants
0