Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pack_rows break footnote alignment #880

Open
zjllee opened this issue Dec 18, 2024 · 0 comments
Open

pack_rows break footnote alignment #880

zjllee opened this issue Dec 18, 2024 · 0 comments

Comments

@zjllee
Copy link

zjllee commented Dec 18, 2024

Describe the bug
If I use pack_rows(), the left aligned footnote becomes centre-aligned on the 1st column instead. When pack_rows() is not used the footnote becomes left-aligned again.

#| tbl-cap: "Summary statistics."
#| echo: false
#| message: false
#| warning: false

library(knitr)
library(kableExtra)
library(glue)

sample_size <- nrow(df) # get sample size dynamically

summary_df %>%
    kbl(
        col.names = c("", "Mean", "Std Dev"),
        row.names = FALSE,
        align = "lrr",
        escape = FALSE
    ) %>%
    kable_paper(font_size = 6) %>%
    column_spec(1, width = "80%") %>%
    column_spec(2, width = "10%") %>%
    column_spec(3, width = "10%") %>%
    pack_rows(index = c("Key variables" = 4, "Control variables" = 18)) %>%
    # pack_rows("Key variables", 1, 4) %>%
    # pack_rows("Control variables", 5, 22) %>%
    footnote(general = glue("The summary statistics are calculated from the estimation sample of morning commutes. The sample size is {sample_size}.")
    )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant