Edit whit GT in RSrudio

Good afternoon, could you help me on how I can put 2 superscripts in an example sentence: Movement^ 1 migratory^ 2

Where is this sentence intended to go?

I think we need same example code showing us what you are doing.

look this is the code

tab_spanner(label = "migratory movement", id = "spanner2",columns = c(5:10))%>%

tab_footnote(
footnote = "The percentages are calculated in relation to the international migrant population.",
locations = cells_column_spanners(spanners = "spanner2"
))

and I want a superscript in the word Movement and another in migratory

It looks like you are setting up a fairly complex table (plot?). I'd say we need a lot more information on exactly what you are doing, packages used and so on. Something that may work in one package may not work in another, and without a better idea of your code layout it may be difficult to make good suggestions.

Can you give us a example? See FAQ for some suggestions.

I think that with this, I use the GT library
gt(TAB1)%>%
tab_header(subtitle = md("Estimadores de la población migrante internacional"),
title = md("3") )%>%
opt_align_table_header(align = "left" )%>%

cols_label(
COUNTRY ="COUNTRY",
value = "Población migrante internacional",
COLUMNA01 = "EMIGRANT", COLUMNA02 = 'Total', COLUMNA03 = "in the same house", COLUMNA04 = "Somewhere else",
COLUMNA05 = "not specified", COLUMNA06 = "not specified")%>%

tab_spanner(label = "return migrant", id = "spanner1", columns = c(6:9))

Can you supply a working example complete with sample data? I have only used the gt table package once or twice and do not understand where your code is working within the larger code,
Thanks.

the solution is to use gt's html support, and therefore the html sup tag. example

library(gt)

gt(head(iris)) |>
  tab_spanner(
    label = html("my label<sup>1</sup> with superscript<sup>2</sup>"),
    columns = everything()
  )

Thank you very much if it worked for me, but the detail how to add the text of the superscript I use but the tab_footnote does not, it only adds another superscript.

gt(END)%>%
  tab_spanner(
    label = html("migratory <sup>1</sup>movement<sup>2</sup>"),
    id = "spanner2", columns = c(5:10)
  )%>%
  
   tab_footnote(
    footnote = "The percentages are calculated in relation to the international migrant population.",
    locations = cells_column_spanners(spanners = "spanner2"
    ))

image

can you clarify what the perfect result should look like ? its not clear.
I can maybe guess that you seem to want migratory to have 1 and movement to have 2
but for the 2 to connect to a footnote, and the 1 not being related to any footnote ... this sounds very strange to me, but is that what you are asking for ?

i want both to connect to the footnote with the tab_footnote only i can connect note 2 but not 1

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.