Skip to content

melt drops the class of integer64 columns #993

Closed

Description

@richierocks

To reproduce, try:

DT <- data.table(x = as.integer64(10^(9:18)))
##                       x
##  1:          1000000000
##  2:         10000000000
##  3:        100000000000
##  4:       1000000000000
##  5:      10000000000000
##  6:     100000000000000
##  7:    1000000000000000
##  8:   10000000000000000
##  9:  100000000000000000
## 10: 1000000000000000000

melt(DT, measure.vars = "x")
##     variable         value
##  1:        x 4.940656e-315
##  2:        x 4.940656e-314
##  3:        x 4.940656e-313
##  4:        x 4.940656e-312
##  5:        x 4.940656e-311
##  6:        x 4.940656e-310
##  7:        x 4.940656e-309
##  8:        x 5.431165e-308
##  9:        x 5.620396e-302
## 10:        x 7.832953e-242

integer64 values are stored using numeric values. The numbers shown in the value column after melting are unclass(DT$x).

Activity

  1. arunsrinivasan commented on Jan 3, 2015

    @arunsrinivasan
    Member

    Thanks. melt up until 1.9.4 did not preserve attributes (this is also documented), to be consistent with reshape2. I'll try to commit the newer implementation of melt in 1.9.6 - and that preserves attributes as expected.

    If not, it'll most likely be in 1.9.8.

  2. richierocks commented on Jan 4, 2015

    @richierocks
    Author

    OK, thanks. I get the same behaviour with Date and POSIXct objects, but not with factors (which appear as characters not integers). It might be worth including tests on these types with your new version of melt.

  3. arunsrinivasan commented on Jan 4, 2015

    @arunsrinivasan
    Member

    Yes. It was to be consistent with inconsistency of melt from reshpe2. But I won't do that anymore.

  4. arunsrinivasan commented on Feb 27, 2015

    @arunsrinivasan
    Member

    This commit 07b90de fixes it. melt now retains attributes wherever possible.

  5. added this to the v1.9.6 milestone on Feb 27, 2015
  6. added a commit that references this issue on Feb 27, 2015
    ee92c58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions