Skip to content

Commit 5cfb69f

Browse files
committed
supressed warning
1 parent 131af20 commit 5cfb69f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

R/groupingsets.R

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,14 @@ groupingsets.data.table = function(x, j, by, sets, .SDcols, id = FALSE, jj, labe
112112
.SDcols = if (".SD" %chin% av) setdiff(names(x), by) else NULL
113113
if (length(names(by))) by = unname(by)
114114
# 0 rows template data.table to keep colorder and type
115-
empty = if (length(.SDcols)) x[0L, eval(jj), by, .SDcols=.SDcols] else x[0L, eval(jj), by]
115+
empty = withCallingHandlers(
116+
if (length(.SDcols)) x[0L, eval(jj), by, .SDcols=.SDcols] else x[0L, eval(jj), by],
117+
simpleWarning = function(w) {
118+
if (grepl("no non-missing arguments to min|max", w$message, ignore.case = TRUE)) {
119+
invokeRestart("muffleWarning")
120+
}
121+
}
122+
)
116123
if (id && "grouping" %chin% names(empty)) # `j` could have been evaluated to `grouping` field
117124
stopf("When using `id=TRUE` the 'j' expression must not evaluate to a column named 'grouping'.")
118125
if (anyDuplicated(names(empty)) > 0L)

0 commit comments

Comments
 (0)