Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
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 @@ -21683,3 +21683,8 @@ max_ppsize = local({
x = as.data.table(as.list(1:max_ppsize))
test(2376, rbindlist(list(x)), x)
rm(x, max_ppsize)

# #7735 col.names="none" should suppress only column headers, not data
test(2377.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(2377.2, print(data.table(x=1:3), class=FALSE, row.names=FALSE, col.names="none"), output=" 1\n 2\n 3")
test(2377.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