我正在尝试在 gt_table 中的 groupname_col 的标签内创建换行符
有没有办法针对这块表?
我知道如何使用 fmt_markdown 在常规列中插入换行符,但不能应用于行标签
感谢帮助
这是我尝试过的示例
我希望我的组行有一个换行符,如变量 group_label 中所示
library(tidyverse)
library(gt)
df <- tibble(
name = c("john", "john", "jerry", "jerry", "jack", "jack", "jim", "jim"),
day = c("wed", "wed", "thurs", "thurs", "mon", "mon", "tues", "tues"),
lotto = c(12, 42, 54, 57, 234, 556, 34, 23)
)
df %>%
mutate(group_label = paste(name, day, sep = "<br>")) %>%
gt(
groupname_col = "group_label",
rowname_col = "day"
) %>%
cols_hide(
columns = vars(name)
) %>%
fmt_markdown(
columns = vars(group_label)
)