Skip to content

Commit

Permalink
Merge pull request #1925 from magnusdv/rowname-translation
Browse files Browse the repository at this point in the history
More efficient `rownum_translation()`
  • Loading branch information
rich-iannone authored Nov 22, 2024
2 parents 1e4bae1 + b2ff8b9 commit 96c4dba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
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

5 comments on commit 96c4dba

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.