Skip to content

forder should detect and switch to integer type on columns that aren't really double #1738

@arunsrinivasan

Description

@arunsrinivasan
require(data.table)
set.seed(1L)
dt = data.table(d=sample(seq(as.Date("2015-01-01"), as.Date("2015-12-31"), by="days"), 1e7, TRUE))
typeof(dt$d)  # double

system.time(dt[, .N, by=d]) # 0.7s
system.time(dt[, .N, by=as.numeric(d)]) # 0.7s
system.time(dt[, .N, by=as.integer(d)]) # 0.2s

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions