Search code examples
rr-markdowntidyversegt

Is there a way to rename table column with a greek symbol in gt package?


So this is my code and i would like to create a table with the package gt and change the column name "Estimate" by the greek symbol beta

library(gt)
gt() %>% cols_label(
    "Estimate" = expression(beta)
)

thanks in advance


Solution

  • You have several options but you can't use plotmath expressions afaik. You can use the unicode encoding, paste it directly as a character, or use the html() helper function and pass the character reference:

    gt() %>% 
      cols_label("Estimate" = "\U03B2")
    

    or

    gt() %>% 
      cols_label("Estimate" = "β")
    

    or

    gt() %>% 
      cols_label("Estimate" = html("β"))