I have the following table:
datasets::mtcars %>%
head(5) %>%
gt() %>%
tab_footnote("Footnote: Go Below",
locations = cells_body(columns = mpg,
rows = c(2))) %>%
tab_source_note("Source:PUT THIS ON TOP")
Which gives me this output:
The problem I am having is that I need the footnotes below the source: changing the position of the code doesn't work either.
datasets::mtcars %>%
head(5) %>%
gt() %>% tab_source_note("Source: PUT THIS ON TOP") %>%
tab_footnote("Footnote: Go Below",
locations = cells_body(columns = mpg,
rows = c(2)))
Desired Output:
Update: This code works but not as intended
custom_css1 <- paste0("
#two .gt_sourcenote {
color: red;
position: absolute;
top: ",240,"px;
}")
custom_css2 <- paste0("
#two .gt_footnote {
color: blue;
position: absolute;
top: ",270,"px;
}")
datasets::mtcars %>%
head(5) %>%
gt(id="two") %>%
tab_footnote("Footnote: Go Below",
locations = cells_body(columns = mpg,
rows = c(2))) %>%
tab_footnote("Footnote2: Go Below2",
locations = cells_body(columns = mpg,
rows = c(5))) %>%
tab_source_note("Source:PUT THIS ON TOP") %>%
opt_css(
css = custom_css1
) %>%
opt_css(
css = custom_css2
)