Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5247 +/- ##
==========================================
+ Coverage 97.51% 97.53% +0.02%
==========================================
Files 80 80
Lines 14920 14920
==========================================
+ Hits 14549 14552 +3
+ Misses 371 368 -3 ☔ View full report in Codecov by Sentry. |
|
Another inconsistency with length-1 list in And this PR seems to fix that too (even if it seems that the names were returned when PR was created in 2021): Maybe adding an extra test with names could be useful. |
|
hi @jangorecki @MichaelChirico I would like to include this fix in next release, and I believe that it is ready to merge into master, so could you please review and/or merge if you agree that it is ready? Thanks! |
| test(2182.4, melt(DTid, measure.vars=list(a=c(NA,"a2"), b=c("b1","b2")), id.vars="id"), exid) | ||
| test(2182.5, melt(DT.wide, measure.vars=list(a=c(NA,1), b=2:3), na.rm=TRUE), data.table(variable=factor(2), a=2, b=2)) | ||
| test(2182.6, melt(DT.wide, measure.vars=list(b=c("b1","b2"))), data.table(a2=2, variable=factor(c("b1","b2")), b=c(1,2))) # measure.vars named list length=1, #5065 | ||
| test(2182.6, melt(DT.wide, measure.vars=list(b=c("b1","b2"))), data.table(a2=2, variable=factor(c("1","2")), b=c(1,2))) # measure.vars named list length=1, #5065 |
There was a problem hiding this comment.
this is the new result using this PR
> melt(DT.wide, measure.vars=list(b=c("b1","b2")))
a2 variable b
<num> <fctr> <num>
1: 2 1 1
2: 2 2 2
> melt(DT.wide, measure.vars=c("b1","b2"))
a2 variable value
<num> <fctr> <num>
1: 2 b1 1
2: 2 b2 2|
Minor feedback only. It does look like it could be a breaking change, though? We can merge and see what revdep testing tells us. |
Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
|
yes it could be a breaking change. I can follow up and suggest fixes for any revdeps that show up. |
Here are some places to look beyond CRAN packages: |
MichaelChirico
left a comment
There was a problem hiding this comment.
Feel free to merge after addressing latest round of review. Thanks!
|
I feel we are much less strict about backward compatibility than we used to be. Checking revdeps is not sufficient IMO, it is not sufficient by a huge factor. First, most of pkgs on CRAN does not have good test coverage. Second, we don't know how many revdeps there are which are not o CRAN or github, I would assume at least 3-4 times more than CRAN. Third, there are thousands of plain scripts. Current process of looking at cran/bioc revdeps, and checking github for the usage is as much as we can do, but IMO not enough to jump in with breaking changes. Let's try to give at least 1 release cycle for transition. We could have extra section in NEWS file "breaking changes in next release" which described how to switch to new behavior. |
|
While you make a very good point in general, in this case, we are aligning implementation with documented behavior. I am not sure we should be as deferential to users relying on bugs/undocumented behavior. Revdeps/GH search can help us in this case -- if many users wound up relying on this, we should proceed more carefully. |
Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
great idea Jan, I added a sentence about that:
|
Closes #5209
This was not a big problem, but it would be nice for consistency: whenever user specifies measure.vars=list, variable column should contains indices rather than column names. Increased consistency may help avoid issues such as #5201 in which a user thought that
measure.vars=list(...)andmeasure.vars=c(...)should yield same result (docs say otherwise).Previous behavior: (master/CRAN)
New behavior:
Main fix involves checking if measure.vars is list in fmelt C code.
To make some old tests keep passing, I had to change
patterns: when one argument/pattern input, used to output a list with one element (integer vector of match indices), now returns just the integer vector (not in a list). When used likemelt(DT, measure.vars=patterns("^a")we therefore still get the same result as before this PR (variable is column name, not index)..SDcols=patterns("^a")again patterns returns vector instead of list so that needed to be special cased in[.data.table-- just use that vector instead of trying to pass it throughReduce(intersect, ...)-- again same results as before this PR.