Skip to content
Closed
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
12 changes: 8 additions & 4 deletions R/print.data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,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
cut_colnames(print(x, right=TRUE, quote=quote, na.print=na.print))
if (col.names == "none") {
# #7735: blank column names in output directly instead of using cut_colnames,
# which also drops data rows lacking row-number colons (row.names=FALSE)
colnames(x) = rep.int("", ncol(x))
writeLines(capture.output(print(x, right=TRUE, quote=quote, na.print=na.print)))
} else {
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 All @@ -141,8 +147,6 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
print_default(toprint)
return(invisible(x))
}
if (col.names == "none")
colnames(toprint) = rep.int("", ncol(toprint))
if (nrow(toprint)>20L && col.names == "auto")
# repeat colnames at the bottom if over 20 rows so you don't have to scroll up to see them
# option to shut this off per request of Oleg Bondar on SO, #1482
Expand Down
Loading