Gt: Need for cells_footnote()?

Created on 15 Nov 2020  Â·  3Comments  Â·  Source: rstudio/gt

It would be great to have a location helper for targeting the footnote (apologies if it exists).

If that is technically possible, it would make it easier to change aspects of the footnote.
For now, as far as I understand, tab_options() let you change the font size (footnotes.font.size) but nothing else about the text.

The location helper would avoid the multiplication of arguments in tab_options() and it would also avoid HTML.

Example (using HTML as workaround):

library(gt)

set.seed(1)
tb <- data.frame(x = sample(1:10))

tb %>%
  gt() %>%
  tab_style(style = cell_borders(color = "red"),
            locations = cells_body(columns = vars(x), rows = which.min(tb$x))) %>%
   tab_footnote(footnote = md("<p style=color:red>smallest value</p>"),
                locations = cells_body(columns = vars(x), rows = which.min(tb$x))) %>%
  tab_options(footnotes.marks = "standard")

image

[3] Advanced [3] High [2] Medium ★ Enhancement

Most helpful comment

Excellent idea. Thank you for suggesting this. I think cells_source_note() is also required.

All 3 comments

Excellent idea. Thank you for suggesting this. I think cells_source_note() is also required.

Came here to ask how to use tab_style could be used to target a tab_source_note text. Seems like the idea of a cells_source_note() helper is what's needed. Yes please... consider this my +1

@courtiol @francisbarton Sorry I didn't include this issue in the recent PR but these new functions were added in https://github.com/rstudio/gt/pull/737.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

scotbader8858 picture scotbader8858  Â·  4Comments

higgi13425 picture higgi13425  Â·  3Comments

vikram-rawat picture vikram-rawat  Â·  3Comments

Torvaney picture Torvaney  Â·  3Comments

jthomasmock picture jthomasmock  Â·  3Comments