From 5df39df6fdede5391581aeb856d745313d8d7840 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Tue, 20 Jan 2026 13:02:42 -0800 Subject: [PATCH 1/4] use deparse1() in error message --- R/fcast.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/fcast.R b/R/fcast.R index 1bcc2916f..adc1273a2 100644 --- a/R/fcast.R +++ b/R/fcast.R @@ -14,7 +14,7 @@ dcast = function( ) { # TODO(>=1.19.0): Remove this, just let dispatch to 'default' method fail. if (!is.data.table(data)) - stopf("The %1$s generic in data.table has been passed a %2$s, but data.table::%1$s currently only has a method for data.tables. Please confirm your input is a data.table, with setDT(%3$s) or as.data.table(%3$s). If you intend to use a method from reshape2, try installing that package first, but do note that reshape2 is superseded and is no longer actively developed.", "dcast", class1(data), deparse(substitute(data))) # nocov + stopf("The %1$s generic in data.table has been passed a %2$s, but data.table::%1$s currently only has a method for data.tables. Please confirm your input is a data.table, with setDT(%3$s) or as.data.table(%3$s). If you intend to use a method from reshape2, try installing that package first, but do note that reshape2 is superseded and is no longer actively developed.", "dcast", class1(data), deparse1(substitute(data))) # nocov UseMethod("dcast", data) } From 337d57c49f64dd6c6c19672452e69f12f98b87f7 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Tue, 20 Jan 2026 13:13:15 -0800 Subject: [PATCH 2/4] Actually just drop the branch --- NEWS.md | 2 +- R/fcast.R | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 4afcc380b..f7f324a61 100644 --- a/NEWS.md +++ b/NEWS.md @@ -46,7 +46,7 @@ 9. `foverlaps()` no longer crashes due to out-of-bounds access to list and integer vectors when `y` has no rows or the non-range part of the join fails, [#7597](https://github.com/Rdatatable/data.table/issues/7597). Thanks to @nextpagesoft for the report and @aitap for the fix. -10. The dynamic library now exports only `R_init_data_table`, preventing symbol name conflicts like `hash_create` with PostgreSQL, [#7605](https://github.com/Rdatatable/data.table/issues/7605). Thanks to @ced75 for the report and @aitap for the fix +10. The dynamic library now exports only `R_init_data_table`, preventing symbol name conflicts like `hash_create` with PostgreSQL, [#7605](https://github.com/Rdatatable/data.table/issues/7605). Thanks to @ced75 for the report and @aitap for the fix. ### Notes diff --git a/R/fcast.R b/R/fcast.R index adc1273a2..c11eb76d5 100644 --- a/R/fcast.R +++ b/R/fcast.R @@ -12,9 +12,6 @@ dcast = function( data, formula, fun.aggregate = NULL, ..., margins = NULL, subset = NULL, fill = NULL, value.var = guess(data) ) { - # TODO(>=1.19.0): Remove this, just let dispatch to 'default' method fail. - if (!is.data.table(data)) - stopf("The %1$s generic in data.table has been passed a %2$s, but data.table::%1$s currently only has a method for data.tables. Please confirm your input is a data.table, with setDT(%3$s) or as.data.table(%3$s). If you intend to use a method from reshape2, try installing that package first, but do note that reshape2 is superseded and is no longer actively developed.", "dcast", class1(data), deparse1(substitute(data))) # nocov UseMethod("dcast", data) } From 018ac39e26fc64158377181a55c4af03b3d73a3a Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Tue, 20 Jan 2026 13:15:38 -0800 Subject: [PATCH 3/4] ditto melt() --- NAMESPACE | 1 - R/fmelt.R | 5 ----- 2 files changed, 6 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index d712b318a..8381a14a7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -139,7 +139,6 @@ S3method(split, data.table) export(dcast, melt) S3method(dcast, data.table) S3method(melt, data.table) -S3method(melt, default) # exported for historical reasons -- if reshape2 is higher on search path, # dcast(DT) will not dispatch since reshape2::dcast is not generic. So users diff --git a/R/fmelt.R b/R/fmelt.R index e0596f73f..85a8a641e 100644 --- a/R/fmelt.R +++ b/R/fmelt.R @@ -7,11 +7,6 @@ melt = function(data, ..., na.rm = FALSE, value.name = "value") { UseMethod("melt", data) } -# TODO(>=1.19.0): Remove this, just let dispatch to 'default' method fail. -melt.default = function(data, ..., na.rm = FALSE, value.name = "value") { - stopf("The %1$s generic in data.table has been passed a %2$s and will attempt to redirect to the relevant reshape2 method; please note that reshape2 is superseded and is no longer actively developed, and this redirection is now deprecated. To continue using melt methods from reshape2 while both packages are attached, e.g. melt.list, you can prepend the namespace, i.e. reshape2::%1$s(%3$s). In the next version, this warning will become an error.", "melt", class1(data), deparse(substitute(data))) # nocov -} - patterns = function(..., cols=character(0L), ignore.case=FALSE, perl=FALSE, fixed=FALSE, useBytes=FALSE) { # if ... has no names, names(list(...)) will be ""; # this assures they'll be NULL instead From ff7f4de95a5a706cd10052ac64a25dfd13f16353 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Tue, 20 Jan 2026 13:16:53 -0800 Subject: [PATCH 4/4] NEWS --- NEWS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NEWS.md b/NEWS.md index f7f324a61..10c3e6961 100644 --- a/NEWS.md +++ b/NEWS.md @@ -60,6 +60,8 @@ 5. The data.table test suite is a bit more robust to lacking UTF-8 support via a new `requires_utf8` argument to `test()` to skip tests when UTF-8 support is not available, [#7336](https://github.com/Rdatatable/data.table/issues/7336). Thanks @MichaelChirico for the suggestion and @ben-schwen for the implementation. +6. `melt()` and `dcast()` no longer provide nudges when receiving incompatible inputs (e.g. data.frames). As of now, we only define methods for `data.table` inputs. + ## data.table [v1.18.0](https://github.com/Rdatatable/data.table/milestone/37?closed=1) 23 December 2025 ### BREAKING CHANGE