From 71ac34a429870f18d583cff4ace193e2d8c90612 Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Thu, 31 Oct 2024 16:54:41 +0000 Subject: [PATCH] Revert "Don't warn about numeric coercion in set(j=)" This reverts commit f6c138575f5157bebde0ff0c22601cd1ec983bd4. --- NEWS.md | 2 -- src/assign.c | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 59f25a77f7..4236e8b078 100644 --- a/NEWS.md +++ b/NEWS.md @@ -133,8 +133,6 @@ rowwiseDT( 8. `measurev()` was implemented and documented in v1.15.0, for use within `melt()`, and it is now exported (dependent packages can now use without a NOTE from CRAN check). -9. Using a double vector in `set()`'s `j=` no longer throws a warning about preferring integer, [#6594](https://github.com/Rdatatable/data.table/issues/6594). While it may improve efficiency to use integer, there's no guarantee it's an improvement and the difference is likely to be minimal. The coercion will still be reported under `datatable.verbose=TRUE`. For package/production use cases, static analyzers such as `lintr::implicit_integer_linter()` can also report when numeric literals should be rewritten as integer literals. - # data.table [v1.16.0](https://github.com/Rdatatable/data.table/milestone/30) (25 August 2024) ## BREAKING CHANGES diff --git a/src/assign.c b/src/assign.c index 2f6715e83b..b280c2259f 100644 --- a/src/assign.c +++ b/src/assign.c @@ -425,8 +425,7 @@ SEXP assign(SEXP dt, SEXP rows, SEXP cols, SEXP newcolnames, SEXP values) } else { if (isReal(cols)) { cols = PROTECT(coerceVector(cols, INTSXP)); protecti++; - if (verbose) - Rprintf(_("Coerced j from numeric to integer. Please pass integer for efficiency; e.g., 2L rather than 2")); + warning(_("Coerced j from numeric to integer. Please pass integer for efficiency; e.g., 2L rather than 2")); } if (!isInteger(cols)) error(_("j is type '%s'. Must be integer, character, or numeric is coerced with warning."), type2char(TYPEOF(cols)));