Skip to content

Inconsistent .SDcols behavior NA vs. NA_character #3118

@MichaelChirico

Description

@MichaelChirico

Uncovered in work on #3116

DT = data.table(a = 1:5)
DT[ , .SD, .SDcols = NA]
# Null data.table (0 rows and 0 cols)
DT[ , .SD, .SDcols = NA_character_]

Error in [.data.table(DT, , .SD, .SDcols = NA_character_) :
Some items of .SDcols are not column names (or are NA)

I guess should error in both cases...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions