Skip to content

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

Closed

Description

@arunsrinivasan

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.

Activity

  1. MichaelChirico commented on Mar 18, 2016

    @MichaelChirico
    Member

    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

  2. jangorecki commented on Mar 18, 2016

    @jangorecki
    Member

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

  3. added this to the milestone on Aug 3, 2016
  4. arunsrinivasan commented on Aug 3, 2016

    @arunsrinivasan
    MemberAuthor

    dup of #1444.

  5. removed this from the milestone on Nov 23, 2016
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

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions