Skip to content

Commit eeb94b6

Browse files
committed
added condition
1 parent 1e2e3ba commit eeb94b6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

R/print.data.table.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
141141
print_default(toprint)
142142
return(invisible(x))
143143
}
144+
if (col.names == "none")
145+
colnames(toprint) = rep.int("", ncol(toprint))
144146
if (nrow(toprint)>20L && col.names == "auto")
145147
# repeat colnames at the bottom if over 20 rows so you don't have to scroll up to see them
146148
# option to shut this off per request of Oleg Bondar on SO, #1482

inst/tests/tests.Rraw

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21358,3 +21358,11 @@ test(2327.1, cube(DT, .(min(value)), "var"),
2135821358
test(2327.2, cube(DT, .(as.numeric(base::min(value, na.rm=TRUE))), "var"),
2135921359
data.table(var = c("a", "b", "c", "d", NA), V1 = c(1.0, 2.0, 3.0, Inf, 1.0)),
2136021360
warning="no non-missing arguments to min")
21361+
21362+
#6882 print() output with col.names="none"
21363+
dt = data.table(short = 1:3, verylongcolumnname = 4:6)
21364+
test(2328.1, print(dt, col.names = "none"), output = "1: 1 4\n2: 2 5\n3: 3 6\n")
21365+
dt = data.table(x = 123456, y = "wide_string")
21366+
test(2328.2, print(dt, col.names = "none"), output = "1: 123456 wide_string\n")
21367+
dt = data.table(a = NA_integer_, b = NaN)
21368+
test(2328.3, print(dt, col.names = "none"), output = "1: NA NaN\n")

0 commit comments

Comments
 (0)