5

我想右对齐,rowname_col但看起来你不能应用于cols_align行名?

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

在此处输入图像描述

4

1 回答 1

4

您可以像这样右对齐 rowname 列:

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)
  )

在此处输入图像描述

于 2020-05-19T09:28:52.183 回答