Skip to content

Clarify error message on by = list() #3270

@MichaelChirico

Description

@MichaelChirico

This line has an error message:

https://github.com/Rdatatable/data.table/blob/master/R/data.table.R#L954

if (length(bysubl)<2L) stop("When 'by' or 'keyby' is list() we expect something inside the brackets")

However I don't think it's possible to reach that branch in the current code flow because:

DT = data.table(a = 1:10)
DT[ , sum(a), by = .()]
#    V1
# 1: 55

This output looks OK to me... should we just axe this error, or should we move the branch logic so that it actually gets triggered (e.g. put the length(bysubl) < 2L condition a few lines earlier)?

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