Skip to content

Commit d97409e

Browse files
committed
copy measure.vars code, modify for id.vars
1 parent 21fa66b commit d97409e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

R/fmelt.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ melt.data.table = function(data, id.vars, measure.vars, variable.name = "variabl
183183
verbose = getOption("datatable.verbose")) {
184184
if (!is.data.table(data)) stopf("'data' must be a data.table")
185185
if (missing(id.vars)) id.vars=NULL
186+
id.sub = substitute(id.vars)
187+
if (is.call(id.sub)) {
188+
eval.result = eval_with_cols(id.sub, names(data))
189+
if (!is.null(eval.result)) {
190+
id.vars = eval.result
191+
}
192+
}
186193
if (missing(measure.vars)) measure.vars = NULL
187194
measure.sub = substitute(measure.vars)
188195
if (is.call(measure.sub)) {

0 commit comments

Comments
 (0)