Skip to content

Allow type override in := when i is just order() #2925

Description

@MichaelChirico
DT = data.table(a = 1:10)
DT[order(-a), a := paste0(a)]

This errors saying we should be explicit about type overrides, but:

DT[ , a := paste0(a)]

This code works fine (and is of course identical, but the same problem arises when the column update is order-dependent). Presumably this is because when i is non-empty, := suspects there could be a type collision if assigning a new type to a subset of rows.

But order queries in i are incapable of subsetting, so I would expect the behavior to be identical.

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