Restore reshape2 redirection (with warning)#3763
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3763 +/- ##
==========================================
+ Coverage 99.41% 99.41% +<.01%
==========================================
Files 71 71
Lines 13155 13197 +42
==========================================
+ Hits 13078 13120 +42
Misses 77 77
Continue to review full report at Codecov.
|
| # reshape2::dcast is not generic so we have to call it explicitly. See comments at the top of fmelt.R too. | ||
| ns = tryCatch(getNamespace("reshape2"), error=function(e) | ||
| stop("The dcast generic in data.table has been passed a ",class(data)[1L]," (not a data.table) but the reshape2 package is not installed to process this type. Please either install reshape2 and try again, or pass a data.table to dcast instead.")) | ||
| warning("The dcast generic in data.table has been passed a ", class(data)[1L], " and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is deprecated, and this redirection is now deprecated as well.") |
There was a problem hiding this comment.
We should propose a solution in this warning message. Something like
if you attach both packages use melt/dcast prefixing expected namespace. Or move to using data.table versions, and report if any features you are using are missing.
There was a problem hiding this comment.
and stating when more or less it will be deprecated (thus might result in breaking code) might be useful too.
There was a problem hiding this comment.
Have updated both the warning and the error, please have a look
| # nocov start | ||
| } else { | ||
| # nocov start | ||
| data_name = deparse(substitute(data)) |
There was a problem hiding this comment.
I would avoid deparse if not really needed, as here. For a very long symbol names it can cause problems. The gain from using that here is really minor.
Closes #3633
follow-up to #3577
I looked at the
reshape2listmethod formelt, it's quite unintuitive to me, so I wouldn't re-implement it as-is todata.table. We might want to addmelt.listin the future but I don't think it would look likereshape2's (which relies onattrof thelistat various levels?)