You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: NEWS.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,6 +101,7 @@
101
101
+Onnon-Windowssystems, `fread()`nowprintsthereasonwhythefilecouldn't be opened, which could also be due to it being too large to map.
102
102
+ With `verbose=TRUE`, file sizes are now printed using correct binary SI prefixes (the sizes have always been reported as bytes denominated in powers of `2^10`, so e.g. `1024*1024` bytes was reported as `1 MB` where `1 MiB` or `1.05 MB` is correct).
103
103
104
+
4. The default `format_list_item()` method (and hence `print.data.table()`) annotates truncated list items with their length, [#605](https://github.com/Rdatatable/data.table/issues/605). Thanks Matt Dowle for the original report (2012!) and @MichaelChirico for the fix.
104
105
105
106
# data.table [v1.17.8](https://github.com/Rdatatable/data.table/milestone/41) (6 July 2025)
"[NULL]"# not '' or 'NULL' to distinguish from those "common" string values in data
229
229
elseif (is.atomic(x) || inherits(x, "formula")) # FR #2591 - format.data.table issue with columns of class "formula"
230
-
paste(c(format(head(x, 6L), ...), if (length(x) >6L) "..."), collapse=",") # fix for #5435and #37 - format has to be added here...
230
+
paste(c(format(head(x, 6L), ...), if (length(x) >6L) sprintf("...[%d]", length(x))), collapse=",") # fix for #5435, #37, and #605 - format has to be added here...
test(10.01, ans<-coerceAs(input, 1), 1, output="double[numeric] into double[numeric]")
258
-
test(10.02, address(input)!=address(ans))
259
-
test(10.03, ans<-coerceAs(input, 1, copy=FALSE), 1, output="copy=false and input already of expected type and class double[numeric]")
260
-
test(10.04, address(input), address(ans))
261
-
test(10.05, ans<-coerceAs(input, 1L), 1L, output="double[numeric] into integer[integer]")
262
-
test(10.06, address(input)!=address(ans))
263
-
test(10.07, ans<-coerceAs(input, 1L, copy=FALSE), 1L, output="double[numeric] into integer[integer]", notOutput="copy=false")
264
-
test(10.08, address(input)!=address(ans))
265
-
test(10.09, coerceAs("1", 1L), 1L, output="character[character] into integer[integer]", warning="Coercing.*character.*integer")
266
-
test(10.10, coerceAs("1", 1), 1, output="character[character] into double[numeric]", warning="Coercing.*character.*double")
267
-
test(10.11, coerceAs("a", factor("x")), factor("a", levels=c("x","a")), output="character[character] into integer[factor]") ## levels of 'as' are retained!
268
-
test(10.12, coerceAs("a", factor()), factor("a"), output="character[character] into integer[factor]")
269
-
test(10.13, coerceAs(1, factor("x")), factor("x"), output="double[numeric] into integer[factor]")
270
-
test(10.14, coerceAs(1, factor("x", levels=c("x","y"))), factor("x", levels=c("x","y")), output="double[numeric] into integer[factor]")
271
-
test(10.15, coerceAs(2, factor("x", levels=c("x","y"))), factor("y", levels=c("x","y")), output="double[numeric] into integer[factor]")
272
-
test(10.16, coerceAs(1:2, xy_factor), xy_factor, output="integer[integer] into integer[factor]")
273
-
test(10.17, coerceAs(1:3, xy_factor), output="integer[integer] into integer[factor]", error="factor numbers.*3 is outside the level range")
274
-
test(10.18, coerceAs(c(1,2,3), xy_factor), output="double[numeric] into integer[factor]", error="factor numbers.*3.000000 is outside the level range")
275
-
test(10.19, coerceAs(factor("x"), xy_factor), factor("x", levels=c("x","y")), output="integer[factor] into integer[factor]")
276
-
test(10.20, coerceAs(factor("x"), xy_factor, copy=FALSE), factor("x", levels=c("x","y")), output="input already of expected type and class") ## copy=F has copyMostAttrib
277
-
a = structure("a", class="a")
278
-
b = structure("b", class="b")
279
-
test(10.21, coerceAs(a, b), structure("a", class="b"), output="character[a] into character[b]")
280
-
a = structure(1L, class="a")
281
-
b = structure(2L, class="b")
282
-
test(10.22, coerceAs(a, b), structure(1L, class="b"), output="integer[a] into integer[b]")
283
-
a = structure(1, class="a")
284
-
b = structure(2, class="b")
285
-
test(10.23, coerceAs(a, b), structure(1, class="b"), output="double[a] into double[b]")
286
-
a = structure(1, class="a")
287
-
b = structure(2L, class="b")
288
-
test(10.24, coerceAs(a, b), structure(1L, class="b"), output="double[a] into integer[b]")
289
-
if (test_bit64) {
290
-
x = as.integer64(1L)
291
-
test(10.81, coerceAs(x, 1), 1, output="double[integer64] into double[numeric]")
292
-
test(10.82, coerceAs(x, 1L), 1L, output="double[integer64] into integer[integer]")
293
-
test(10.83, coerceAs(x, "1"), "1", output="double[integer64] into character[character]")
294
-
test(10.84, coerceAs(1, x), x, output="double[numeric] into double[integer64]")
295
-
test(10.85, coerceAs(1L, x), x, output="integer[integer] into double[integer64]")
296
-
test(10.86, coerceAs("1", x), x, output="character[character] into double[integer64]", warning="Coercing.*character")
297
-
options(datatable.verbose=3L)
298
-
test(10.87, coerceAs(x, 1L), 1L, output=c("double[integer64] into integer[integer]","Zero-copy coerce when assigning 'integer64' to 'integer'"))
299
-
test(10.88, coerceAs(1L, x), x, output=c("integer[integer] into double[integer64]","Zero-copy coerce when assigning 'integer' to 'integer64'"))
300
-
options(datatable.verbose=2L)
301
-
test(10.89, coerceAs(-2147483649, x), as.integer64(-2147483649), output="double[numeric] into double[integer64]")
302
-
}
303
-
# 10.91 tested nanotime moved to other.Rraw 27.21, #6139
254
+
local({
255
+
old = options(datatable.verbose=2L); on.exit(options(old))
256
+
input = 1
257
+
# use levels= explicitly to avoid locale-related sorting of letters
test(10.01, ans<-coerceAs(input, 1), 1, output="double[numeric] into double[numeric]")
260
+
test(10.02, address(input)!=address(ans))
261
+
test(10.03, ans<-coerceAs(input, 1, copy=FALSE), 1, output="copy=false and input already of expected type and class double[numeric]")
262
+
test(10.04, address(input), address(ans))
263
+
test(10.05, ans<-coerceAs(input, 1L), 1L, output="double[numeric] into integer[integer]")
264
+
test(10.06, address(input)!=address(ans))
265
+
test(10.07, ans<-coerceAs(input, 1L, copy=FALSE), 1L, output="double[numeric] into integer[integer]", notOutput="copy=false")
266
+
test(10.08, address(input)!=address(ans))
267
+
test(10.09, coerceAs("1", 1L), 1L, output="character[character] into integer[integer]", warning="Coercing.*character.*integer")
268
+
test(10.10, coerceAs("1", 1), 1, output="character[character] into double[numeric]", warning="Coercing.*character.*double")
269
+
test(10.11, coerceAs("a", factor("x")), factor("a", levels=c("x","a")), output="character[character] into integer[factor]") ## levels of 'as' are retained!
270
+
test(10.12, coerceAs("a", factor()), factor("a"), output="character[character] into integer[factor]")
271
+
test(10.13, coerceAs(1, factor("x")), factor("x"), output="double[numeric] into integer[factor]")
272
+
test(10.14, coerceAs(1, factor("x", levels=c("x","y"))), factor("x", levels=c("x","y")), output="double[numeric] into integer[factor]")
273
+
test(10.15, coerceAs(2, factor("x", levels=c("x","y"))), factor("y", levels=c("x","y")), output="double[numeric] into integer[factor]")
274
+
test(10.16, coerceAs(1:2, xy_factor), xy_factor, output="integer[integer] into integer[factor]")
275
+
test(10.17, coerceAs(1:3, xy_factor), output="integer[integer] into integer[factor]", error="factor numbers.*3 is outside the level range")
276
+
test(10.18, coerceAs(c(1,2,3), xy_factor), output="double[numeric] into integer[factor]", error="factor numbers.*3.000000 is outside the level range")
277
+
test(10.19, coerceAs(factor("x"), xy_factor), factor("x", levels=c("x","y")), output="integer[factor] into integer[factor]")
278
+
test(10.20, coerceAs(factor("x"), xy_factor, copy=FALSE), factor("x", levels=c("x","y")), output="input already of expected type and class") ## copy=F has copyMostAttrib
279
+
a = structure("a", class="a")
280
+
b = structure("b", class="b")
281
+
test(10.21, coerceAs(a, b), structure("a", class="b"), output="character[a] into character[b]")
282
+
a = structure(1L, class="a")
283
+
b = structure(2L, class="b")
284
+
test(10.22, coerceAs(a, b), structure(1L, class="b"), output="integer[a] into integer[b]")
285
+
a = structure(1, class="a")
286
+
b = structure(2, class="b")
287
+
test(10.23, coerceAs(a, b), structure(1, class="b"), output="double[a] into double[b]")
288
+
a = structure(1, class="a")
289
+
b = structure(2L, class="b")
290
+
test(10.24, coerceAs(a, b), structure(1L, class="b"), output="double[a] into integer[b]")
291
+
if (test_bit64) {
292
+
x = as.integer64(1L)
293
+
test(10.81, coerceAs(x, 1), 1, output="double[integer64] into double[numeric]")
294
+
test(10.82, coerceAs(x, 1L), 1L, output="double[integer64] into integer[integer]")
295
+
test(10.83, coerceAs(x, "1"), "1", output="double[integer64] into character[character]")
296
+
test(10.84, coerceAs(1, x), x, output="double[numeric] into double[integer64]")
297
+
test(10.85, coerceAs(1L, x), x, output="integer[integer] into double[integer64]")
298
+
test(10.86, coerceAs("1", x), x, output="character[character] into double[integer64]", warning="Coercing.*character")
299
+
test(10.87, options=c(datatable.verbose=3L),
300
+
coerceAs(x, 1L), 1L, output=c("double[integer64] into integer[integer]", "Zero-copy coerce when assigning 'integer64' to 'integer'"))
301
+
test(10.88, options=c(datatable.verbose=3L),
302
+
coerceAs(1L, x), x, output=c("integer[integer] into double[integer64]", "Zero-copy coerce when assigning 'integer' to 'integer64'"))
303
+
test(10.89, options=c(datatable.verbose=2L),
304
+
coerceAs(-2147483649, x), as.integer64(-2147483649), output="double[numeric] into double[integer64]")
305
+
}
306
+
# 10.91 tested nanotime moved to other.Rraw 27.21, #6139
307
+
})
304
308
305
-
options(datatable.verbose=FALSE)
306
309
test(11.01, coerceAs(list(a=1), 1), error="is not atomic")
307
310
test(11.02, coerceAs(1, list(a=1)), list(1))
308
311
test(11.03, coerceAs(sum, 1), error="is not atomic")
@@ -328,6 +331,4 @@ test(11.09, coerceAs(1L, a), error="must not be matrix or array")
328
331
test(99.1, data.table(a=1,b=2)[1,1, verbose=1], error="verbose must be logical or integer")
329
332
test(99.2, data.table(a=1,b=2)[1,1, verbose=1:2], error="verbose must be length 1 non-NA")
330
333
test(99.3, data.table(a=1,b=2)[1,1, verbose=NA], error="verbose must be length 1 non-NA")
331
-
options(datatable.verbose=1)
332
-
test(99.4, coerceAs(1, 2L), error="verbose option must be length 1 non-NA logical or integer")
333
-
options(datatable.verbose=FALSE)
334
+
test(99.4, options=c(datatable.verbose=1), coerceAs(1, 2L), error="verbose option must be length 1 non-NA logical or integer")
0 commit comments