Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@

13. `rbindlist()` (and therefore the `rbind()` method for `data.table`s) no longer raises an error upon encountering more than approximately 50000 columns in a list entry, [#7793](https://github.com/Rdatatable/data.table/issues/7793). The bug was introduced in `data.table` version 1.18.2.1. Thanks to @rickhelmus for the report and @aitap for the fix.

14. `print.data.table()` now correctly displays data when `col.names="none"` and `row.names=FALSE`, [#7735](https://github.com/Rdatatable/data.table/issues/7735). Previously, the output was entirely suppressed because the internal logic relied on row markers (e.g., `1:`) to identify data lines. Thanks to @jan-swissre for the report and @YourGitHubHandle for the fix.

### Notes

1. {data.table} now depends on R 3.5.0 (2018).
Expand Down
9 changes: 8 additions & 1 deletion R/print.data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,14 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
trunc.cols = length(not_printed) > 0L
}
print_default = function(x) {
if (col.names != "none") cut_colnames = identity
if (col.names != "none") {
cut_colnames = identity
} else if (isFALSE(row.names)) {
cut_colnames = function(x) {
out = capture.output(x)
if (length(out) > 0L) writeLines(out[-1L])
}
}
cut_colnames(print(x, right=TRUE, quote=quote, na.print=na.print))
# prints names of variables not shown in the print
if (trunc.cols) trunc_cols_message(not_printed, abbs, class, col.names)
Expand Down
5 changes: 5 additions & 0 deletions inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -21775,3 +21775,8 @@ test(2377.44, copy(dt)[!(a < 5 & b != "d"), .ROW := NULL], dt[1:3])
dt = data.table(a=1:3)
test(2377.91, truelength(dt$a), 0L)
test(2377.92, {setallocrow(dt); truelength(dt$a)}, 3L)

# #7735 col.names="none" should suppress only column headers, not data
test(2378.1, print(data.table(c1=1:2, c2=letters[1:2]), nrows=Inf, class=FALSE, row.names=FALSE, show.indices=FALSE, print_keys=FALSE, col.names="none"), output=" 1 a\n 2 b")
test(2378.2, print(data.table(x=1:3), class=FALSE, row.names=FALSE, col.names="none"), output=" 1\n 2\n 3")
test(2378.3, print(data.table(c1=1:3, c2=letters[1:3]), row.names=TRUE, class=FALSE, col.names="none"), output="1: 1 a\n2: 2 b\n3: 3 c")
Loading