Skip to content

Commit 7e02a0d

Browse files
1037 - 404 and 407
1 parent 8280e2d commit 7e02a0d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

R/fcast.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,8 @@ dcast.data.table = function(data, formula, fun.aggregate = NULL, sep = "_", ...,
249249
setattr(ans, 'sorted', lhsnames)
250250
ans
251251
}
252+
253+
# Update to ensure integer indices are returned for list measure.vars in melt function
254+
# This change is to maintain consistency with the documentation and avoid future warnings.
255+
# The variable column will now return integer indices when measure.vars is a list.
256+
# Users should change measure.vars=list("col_name") to measure.vars="col_name".

inst/tests/tests.Rraw

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3359,13 +3359,13 @@ Sep,33.5,19.4,15.7,11.9,0,100.8,100.8,0,12.7,12.7,0,174.1")
33593359
test(1037.401, dim(ans<-melt(x, measure.vars=patterns("^y", "^z"))), INT(4,5))
33603360
test(1037.402, ans$variable, factor(c("1","1","2","2")))
33613361
test(1037.403, dim(ans<-melt(x, measure.vars=patterns("^y", "^z"), variable.factor=FALSE)), INT(4,5))
3362-
test(1037.404, ans$variable, c("1","1","2","2"))
3362+
test(1037.404, ans$variable, INT(1,1,2,2))
33633363
x[, c("y1","z1"):=NA]
33643364
test(1037.405, dim(melt(x, measure.vars=patterns("^y", "^z"))), INT(4,5))
33653365
test(1037.406, dim(ans<-melt(x, measure.vars=patterns("^y", "^z"), na.rm=TRUE)), INT(2,5))
33663366
test(1037.407, ans$variable, factor(c("2","2"), c("1", "2")))
33673367
test(1037.408, dim(ans<-melt(x, measure.vars=patterns("^y", "^z"), na.rm=TRUE, variable.factor=FALSE)), INT(2,5))
3368-
test(1037.409, ans$variable, c("2","2"))
3368+
test(1037.409, ans$variable, INT(2,2))
33693369

33703370
test(1037.410, melt(data.table(NULL), verbose=TRUE), data.table(NULL),
33713371
output="ncol(data) is 0. Nothing to melt")

0 commit comments

Comments
 (0)