Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
MichaelChirico opened this issue Aug 10, 2019 · 0 comments · Fixed by #3761
Closed

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

MichaelChirico opened this issue Aug 10, 2019 · 0 comments · Fixed by #3761
Milestone

Comments

@MichaelChirico
Copy link
Member

@MichaelChirico MichaelChirico commented Aug 10, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants