diff --git a/R/data.table.R b/R/data.table.R index d8def75a8..71e35fa94 100644 --- a/R/data.table.R +++ b/R/data.table.R @@ -136,7 +136,7 @@ print.data.table <- function(x, } toprint=format.data.table(toprint, ...) # FR #5020 - add row.names = logical argument to print.data.table - if (isTRUE(row.names)) rownames(toprint)=paste(format(rn,right=TRUE,scientific=FALSE),":",sep="") else rownames(toprint)=rep.int("", nrow(x)) + if (isTRUE(row.names)) rownames(toprint)=paste(format(rn,right=TRUE,scientific=FALSE),":",sep="") else rownames(toprint)=rep.int("", nrow(toprint)) if (is.null(names(x))) colnames(toprint)=rep("NA", ncol(toprint)) # fixes bug #4934 if (printdots) { toprint = rbind(head(toprint,topn),"---"="",tail(toprint,topn)) diff --git a/README.md b/README.md index 9fdc1b543..042cd5e34 100644 --- a/README.md +++ b/README.md @@ -231,7 +231,9 @@ 61. `merge.data.table()` didn't set column order (and therefore names) properly in some cases. Fixed now. Closes [#1290](https://github.com/Rdatatable/data.table/issues/1290). Thanks to @ChristK for the minimal example. - 63. Printing data.table will not print row numbers in scientific notation. Closes [#1167](https://github.com/Rdatatable/data.table/issues/1167). Thanks to @jangorecki. + 62. print.data.table now works for 100+ rows as intended when `row.names=FALSE`. Closes [#1307](https://github.com/Rdatatable/data.table/issues/1307). Thanks to @jangorecki for the PR. + + 63. Row numbers are not printed in scientific format. Closes [#1167](https://github.com/Rdatatable/data.table/issues/1167). Thanks to @jangorecki for the PR. #### NOTES diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index a6c0a0003..4953f040c 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -3562,10 +3562,12 @@ set.seed(45) DT = data.table(x=c("A", "A", "C", "C"), y=1:4, z=runif(4)) test(1137.12, DT[, lapply(.SD, sum), by=x, .SDcols=-"y"], DT[, lapply(.SD, sum), by=x, .SDcols="z"]) -# test for FR #5020 - print.data.table gets new argument "row.names", default=TRUE. if FALSE, the row-names don't get printed +# test for FR #353 / R-Forge #5020 - print.data.table gets new argument "row.names", default=TRUE. if FALSE, the row-names don't get printed # Thanks to Eddi for `capture.output` function! DT <- data.table(x=1:5, y=6:10) -test(1138, capture.output(print(DT, row.names=FALSE)), c(" x y", " 1 6", " 2 7", " 3 8", " 4 9", " 5 10")) +test(1138.1, capture.output(print(DT, row.names=FALSE)), c(" x y", " 1 6", " 2 7", " 3 8", " 4 9", " 5 10")) +DT <- data.table(x=1:101, y=6:106) # bug described in #1307 +test(1138.2, capture.output(print(DT, row.names=FALSE)), c(" x y", " 1 6", " 2 7", " 3 8", " 4 9", " 5 10", "--- ", " 97 102", " 98 103", " 99 104", " 100 105", " 101 106")) # test for FR #2591 (format.data.table issue with column of class "formula") DT <- data.table(x=c(a~b, c~d+e), y=1:2)