text flextable

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text flextable相关的知识,希望对你有一定的参考价值。

install.packages("flextable")
library(flextable)
library(officer)

myft <- regulartable(
  head(mtcars), 
  col_keys = c("am", "carb", "gear", "mpg", "drat" ))
myft

theme_vanilla(myft)



myft <- merge_v(myft, j = c("am", "carb") )
myft

myft = set_header_labels(myft, carb = "# carb.")
myft = width(myft, width = .75)

myft

myft <- italic(myft, j = 1)
myft <- bg(myft, bg = "#C90000", part = "header")
myft <- color(myft, color = "white", part = "header")
myft

myft <- color(myft, ~ drat > 3.5, ~ drat, color = "red")
myft <- bold(myft, ~ drat > 3.5, ~ drat, bold = TRUE)
myft <- autofit(myft)

myft


regulartable(gender_table) %>% set_formatter_type(fmt_double = "%0.1f") %>% 
  align(part = "header", align = "right") %>% 
  bg(bg = "#E6E6E6", part = "header") %>% bold(part = "header") %>% width(j = ~ Gender, width = 1.75) %>%
  theme_zebra() # themes are: vanilla, zebra, box, booktabs

以上是关于text flextable的主要内容,如果未能解决你的问题,请参考以下文章

如果在 officedown 中使用 gtsummary + flextable,则表格下方的表格标题

如何使 flextable 适合 word_document 输出中侧边框的宽度?降价

将图像添加到要使用 knitr 生成的 flextable 失败但在 RMarkdown 块中有效

如何在flextable中获取小部件的行号?

GWT - 标签没有正确包装文本?

几句话说清楚BFC