Skip to content

Commit 0c6c6b2

Browse files
remove duplicate rbind() call
1 parent 73934da commit 0c6c6b2

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

R/print.data.table.R

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,14 @@ 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-
if (isTRUE(class)) {
146-
# Add both column names and classes when classes are enabled
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)) {
147148
mat_abbs <- matrix(abbs, nrow = 1L)
148149
rownames(mat_abbs) <- ""
149-
toprint <- rbind(toprint, matrix(if (quote) old else colnames(toprint), nrow=1L), matrix(abbs, nrow=1L))
150-
} else {
151-
# Original behavior (just column names at bottom)
152-
toprint <- rbind(toprint, matrix(if (quote) old else colnames(toprint), nrow=1L))
150+
mat_abbs
153151
}
152+
)
154153
print_default(toprint)
155154
invisible(x)
156155
}

0 commit comments

Comments
 (0)