Skip to content

Commit d8931a1

Browse files
data.table style
1 parent 744e3af commit d8931a1

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

R/print.data.table.R

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,9 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
142142
if (nrow(toprint)>20L && col.names == "auto")
143143
# repeat colnames at the bottom if over 20 rows so you don't have to scroll up to see them
144144
# option to shut this off per request of Oleg Bondar on SO, #1482
145-
toprint <- rbind(toprint, matrix(if (quote) old else colnames(toprint), nrow=1L),
146-
# add column class only when class=TRUE
147-
if(isTRUE(class)) {
148-
mat_abbs <- matrix(abbs, nrow = 1L)
149-
rownames(mat_abbs) <- ""
145+
toprint = rbind(toprint, matrix(if (quote) old else colnames(toprint), nrow=1L), if (isTRUE(class)) {
146+
mat_abbs = matrix(abbs, nrow=1L)
147+
rownames(mat_abbs) = ""
150148
mat_abbs
151149
})
152150
print_default(toprint)

inst/tests/tests.Rraw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21131,7 +21131,7 @@ DF = list(rep(iconv("\uf8", from = "UTF-8", to = "latin1"), 2e6))
2113121131
test(2312, fwrite(DF, nullfile(), encoding = "UTF-8", nThread = 2L), NULL)
2113221132

2113321133
# Testing column footer display with col.names options in print.data.table #6902
21134-
dt = data.table(id = 1:25, value = sample(letters, 25, replace = TRUE), number = rnorm(25))
21134+
dt = data.table(id = 1:25)
2113521135
# Test with class=TRUE shows classes at bottom with default col.names="auto"
2113621136
test(2313.1, any(grepl("<int>", tail(capture.output(print(dt, class = TRUE)), 2))), TRUE)
2113721137
# Test that class=TRUE with col.names="top" doesn't show classes at bottom

0 commit comments

Comments
 (0)