diff --git a/NEWS.md b/NEWS.md index c02a2589f..8b38cf82c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -80,8 +80,6 @@ 18. `example(local=TRUE)` where the example uses `[.data.table` works again (e.g. `example(':=', package='data.table', local=TRUE, echo=FALSE)`), [#7855](https://github.com/Rdatatable/data.table/issues/7855) re-fixing [#2972](https://github.com/Rdatatable/data.table/issues/2972). Thanks @michaelChirico for the fix. -19. `fread()` returns a clearer error message when `dec = NA` is used, [#7737](https://github.com/Rdatatable/data.table/issues/7737). Thanks @mcol for the report and the fix. - ### Notes 1. {data.table} now depends on R 3.5.0 (2018). @@ -100,6 +98,10 @@ 8. Clarified `fread()` documentation and vignette regarding the interaction between `keepLeadingZeros = TRUE` and automatic header detection, [#5405](https://github.com/Rdatatable/data.table/issues/5405). Thanks @clemenskuehn for the report and @venom1204 for updating the documentation. +9. `fread()` returns a clearer error message when `dec = NA` is used, [#7737](https://github.com/Rdatatable/data.table/issues/7737). Thanks @mcol for the report and the fix. + +10. `fwrite()` returns a clearer error message when `na = data.frame()` is used, [#7866](https://github.com/Rdatatable/data.table/issues/7866). Thanks @mcol for the report and the fix. + ## data.table [v1.18.4](https://github.com/Rdatatable/data.table/milestone/45) (6 May 2026) ### BUG FIXES diff --git a/R/fwrite.R b/R/fwrite.R index 5d91b4e34..0e4e2ecaf 100644 --- a/R/fwrite.R +++ b/R/fwrite.R @@ -15,7 +15,7 @@ fwrite = function(x, file="", append=FALSE, quote="auto", verbose=getOption("datatable.verbose", FALSE), encoding = "", forceDecimal = FALSE) { - na = as.character(na[1L]) # fix for #1725 + na = as.character(na) # fix for #1725 if (length(encoding) != 1L || !encoding %chin% c("", "UTF-8", "native")) { stopf("Argument 'encoding' must be '', 'UTF-8' or 'native'.") } diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index 9d09f5fb0..f8589ce00 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -10018,6 +10018,7 @@ test(1676.1, fwrite(dt, f, na=NULL), error=base_messages$stopifnot("length(na) = fwrite(dt, f, na=NA) test(1676.2, fread(f), data.table(x=1:2, y=c(NA, "a"))) unlink(f) +test(1676.3, fwrite(dt, na=data.frame()), error=base_messages$stopifnot("length(na) == 1L")) # duplicate names in foverlaps #1730 a = data.table(start = 1:5, end = 2:6, c2 = rnorm(10), c2 = rnorm(10), key=c("start","end"))