Home > Blockchain >  Choose different types of footnote marks in different columns in a gt table
Choose different types of footnote marks in different columns in a gt table

Time:12-19

I want to change the footnote marks in my gt table so that in the wt column, I do not have the number 2 but an asterisk (*).

I want to keep footnote mark 1.

Any help or guidance is appreciated

  library(gt)
  
  # Create a sample gt table with custom footnote marks
  my_table <- gt(
    head(mtcars, 10))

  my_table %>% 
    tab_footnote(
      footnote = "Sequenced twice.",
      locations = cells_body(columns=disp, rows=c(1,2))
    ) %>% 
    tab_footnote(
      footnote = "Change mark",
      locations = cells_body(columns=wt, rows=c(4,5))
    )

enter image description here

CodePudding user response:

We may use opt_footnote_marks

library(gt)
my_table %>%
  tab_footnote(
    footnote = "Sequenced twice.",
    locations = cells_body(columns=disp, rows=c(1,2))
  ) %>%
  tab_footnote(
    footnote = "Change mark",
    locations = cells_body(columns=wt, rows=c(4,5))
  ) %>%
  opt_footnote_marks(    
    marks     = c("1", "*")) 

-output

enter image description here

  • Related