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
Found during some codecov testing. Any other function
foothere (excepteval, since that case is handled differently) the output would be namedfoo. It's because the regex here:Should be
Already fixed as part of a coverage PR forthcoming