Skip to content

Commit a25400a

Browse files
final
1 parent 16d1d65 commit a25400a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

R/print.data.table.R

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
6262
}
6363
return(invisible(x))
6464
}
65+
index_dt <- NULL
6566
if (show.indices) {
6667
if (is.null(indices(x))) {
6768
show.indices = FALSE
@@ -83,17 +84,13 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
8384
toprint = x
8485
rn = seq_len(n_x)
8586
printdots = FALSE
87+
if (!is.null(index_dt) && nrow(index_dt) != nrow(toprint)) {
88+
show.indices = FALSE
89+
}
8690
if (show.indices) toprint = cbind(toprint, index_dt)
8791
}
8892
require_bit64_if_needed(x)
89-
if (!inherits(toprint, "data.frame")) {
90-
class(toprint) <- c("data.table", "data.frame")
91-
}
9293
classes <- classes1(toprint)
93-
col_names <- colnames(toprint)
94-
if (show.indices && !is.null(indices(x))) {
95-
classes <- c(classes, rep("<index>", length(indices(x))))
96-
}
9794
toprint=format.data.table(toprint, na.encode=FALSE, timezone = timezone, ...) # na.encode=FALSE so that NA in character cols print as <NA>
9895

9996
# FR #353 - add row.names = logical argument to print.data.table

0 commit comments

Comments
 (0)