Right align the rowname_col in gt
Asked Answered
T

1

5

I'd like to right align the rowname_col but it doesn't look like you can apply cols_align to rownames?

tibble(
  one = c("Long names", "Other Name", "Name | Name"),
  two = 1:3
) %>% gt(rowname_col = "one") %>%
  cols_align(align = "right", columns = vars(one))

enter image description here

Towhaired answered 18/5, 2020 at 22:22 Comment(0)
G
7

You can right align the rowname column like so:

library(dplyr)
library(gt)

tibble(
  one = c("Long names", "Other Name", "Name | Name"),
  two = 1:3
) %>% gt(rowname_col = "one") %>%
  tab_style(
    style = list(
      cell_text(align = "right")
    ),
    locations = cells_stub(rows = TRUE)
  )

enter image description here

Graiggrail answered 19/5, 2020 at 9:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.