-
Notifications
You must be signed in to change notification settings - Fork 1k
Restore reshape2 redirection (with warning) #3763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,22 @@ | ||
| # reshape2 dependency was originally abandoned because (1) we wanted to be in control | ||
| # of the R version dependency and (2) reshape2::dcast is not generic. | ||
| # Anyway, reshape2 package is deprecated since December 2017. | ||
| # reshape2 package is deprecated since December 2017, so we'll deprecate our | ||
| # redirection as well | ||
|
|
||
| melt = function(data, ..., na.rm = FALSE, value.name = "value") { | ||
| UseMethod("melt", data) | ||
| melt <- function(data, ..., na.rm = FALSE, value.name = "value") { | ||
| if (is.data.table(data)) { | ||
| UseMethod("melt", data) | ||
| # if data is not data.table and reshape2 is installed, this won't dispatch to reshape2's method; | ||
| # CRAN package edarf and others fail without the else branch | ||
| # nocov start | ||
| } else { | ||
| data_name = deparse(substitute(data)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. |
||
| ns = tryCatch(getNamespace("reshape2"), error=function(e) | ||
| stop("The melt generic in data.table has been passed a ",class(data)[1L],", but data.table::melt currently only has a method for data.tables. Please confirm your input is a data.table, with setDT(", data_name, ") or as.data.table(", data_name, "). If you intend to use a method from reshape2, try installing that package first, but do note that reshape2 is deprecated and you should be migrating your code away from using it.")) | ||
| warning("The melt 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. To continue using melt methods from reshape2 while both libraries are attached, e.g. melt.list, you can prepend the namespace like reshape2::melt(", data_name, "). In the next version, this warning will become an error.") | ||
| ns$melt(data, ..., na.rm=na.rm, value.name=value.name) | ||
| } | ||
| # nocov end | ||
| } | ||
|
|
||
| patterns = function(..., cols=character(0L)) { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.