Skip to content

by auto-naming is too greedy on eval-like columns #3758

@MichaelChirico

Description

@MichaelChirico
evaluate = function(x) c('F', 'D', 'C', 'B', 'A')[findInterval(x, c(0, 60, 70, 80, 90, 100))]
data.table(grade = c(50L, 91L, 95L, 51L, 89L))[ , .N, by = evaluate(grade)]
    grade N
1:     F 2
2:     A 2
3:     B 1

Found during some codecov testing. Any other function foo there (except eval, since that case is handled differently) the output would be named foo. It's because the regex here:

tt = grep("^eval|^[^[:alpha:]. ]", byvars, invert=TRUE, value=TRUE)

Should be

tt = grep("^eval$|^[^[:alpha:]. ]", byvars, invert=TRUE, value=TRUE)

Already fixed as part of a coverage PR forthcoming

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