Skip to content

Commit 558d67a

Browse files
add header string
1 parent f463b76 commit 558d67a

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

R/print.data.table.R

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,26 +63,21 @@ print.data.table = function(x, topn=getOption("datatable.print.topn"),
6363
return(invisible(x))
6464
}
6565
if (show.indices) {
66-
indices <- names(attr(x, "index", exact = TRUE)) # Get actual index names
66+
indices <- names(attr(x, "index", exact = TRUE))
6767
if (length(indices)) {
68-
# Clean index formatting
69-
cleaned_indices <- gsub("^__|_", ", ", indices) # Remove prefix and convert _ to ,
70-
cleaned_indices <- sub(", $", "", cleaned_indices) # Trim trailing comma
68+
cleaned_indices <- gsub("^__|_", ", ", indices)
69+
cleaned_indices <- sub(", $", "", cleaned_indices)
7170

7271
# Create header string (matches key display style)
7372
header <- paste0("Indices: ", paste(cleaned_indices, collapse = ", "))
74-
75-
# Add to existing header metadata instead of toprint
7673
if (exists("header", envir = parent.frame(), inherits = FALSE)) {
7774
# Match data.table's existing header handling
7875
assign("header", c(get("header", envir = parent.frame()), header),
7976
envir = parent.frame())
8077
}
81-
82-
# Remove all rbind-to-toprint logic
8378
}
8479
else {
85-
show.indices <- FALSE # No indices found
80+
show.indices <- FALSE
8681
}
8782
}
8883
n_x = nrow(x)

0 commit comments

Comments
 (0)