Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More efficient rownum_translation() #1925

Merged
merged 2 commits into from
Nov 22, 2024
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
@@ -1,5 +1,7 @@
# gt (development version)

* Significantly faster rendering of certain large tables, by optimizing the internal `rownum_translation()` utility. (@magnusdv, #1924)

* Interactive tables can support selection through the `ihtml.selection_mode` option. (@jonthegeek, #1909)

* Tables embedded in Shiny apps with `gt_output()` and `render_gt()` with `ihtml.selection_mode` enabled also act as inputs, reporting the row numbers that are selected (#354, #1368). (@jonthegeek, #1909)
Expand Down
14 changes: 1 addition & 13 deletions R/utils_render_common.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,7 @@ colname_to_colnum <- function(
# Utility function to generate finalized row numbers;
# used in: `resolve_footnotes_styles()`
rownum_translation <- function(body, rownum_start) {

rownum_final <- c()

for (rownum_s in rownum_start) {

rownum_final <-
c(
rownum_final,
which(as.numeric(rownames(body)) == rownum_s)
)
}

rownum_final
match(rownum_start, as.numeric(rownames(body)))
}

#' Render any formatting directives available in the `formats` list
Expand Down
Loading