Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ Thanks to @sritchie73 for reporting and fixing [PR#2631](https://github.com/Rdat

40. Attempt to allocate a wildly large amount of RAM (16EB) when grouping by key and there are close to 2 billion 1-row groups, [#2777](https://github.com/Rdatatable/data.table/issues/2777). Thanks to @jsams for the detailed report.

41. Fix a bug that `print(dt, class=TRUE)` shows only `topn - 1` rows. Thanks to @heavywatal for reporting [#2803]((https://github.com/Rdatatable/data.table/issues/2803) and filing [PR#2804]((https://github.com/Rdatatable/data.table/pull/2804).


#### NOTES

Expand Down
2 changes: 1 addition & 1 deletion R/print.data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ print.data.table <- function(x, topn=getOption("datatable.print.topn"),
}
if (quote) colnames(toprint) <- paste0('"', old <- colnames(toprint), '"')
if (printdots) {
toprint = rbind(head(toprint, topn), "---"="", tail(toprint, topn))
toprint = rbind(head(toprint, topn + isTRUE(class)), "---"="", tail(toprint, topn))
rownames(toprint) = format(rownames(toprint), justify="right")
if (col.names == "none") {
cut_top(print(toprint, right=TRUE, quote=quote))
Expand Down
5 changes: 5 additions & 0 deletions inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -11723,6 +11723,11 @@ fwrite(example, file = (f<-tempfile()))
test(1907, fread(f), example)
unlink(f)

# Print topn rows properly when class=TRUE (#2803)
observed <- capture.output(print(data.table(x = seq_len(6L)), topn = 2L, class = TRUE))
expected <- c(" x", " <int>", " 1: 1", " 2: 2", "--- ", " 5: 5", " 6: 6")
test(1908, observed, expected)


###################################
# Add new tests above this line #
Expand Down