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

stefan
  • 90,330
  • 6
  • 25
  • 51
MayaGans
  • 1,815
  • 9
  • 30

1 Answers1

6

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

stefan
  • 90,330
  • 6
  • 25
  • 51